Skip to content

feat(alert): add a close button element for semantic#55815

Merged
afc163 merged 2 commits intoant-design:featurefrom
coding-ice:feat/alert_close
Nov 24, 2025
Merged

feat(alert): add a close button element for semantic#55815
afc163 merged 2 commits intoant-design:featurefrom
coding-ice:feat/alert_close

Conversation

@coding-ice
Copy link
Copy Markdown
Member

中文版模板 / Chinese template

🤔 This is a ...

  • 🆕 New feature

🔗 Related Issues

#55133

  • Describe the source of related requirements, such as links to relevant issue discussions.
  • For example: close #xxxx, fix #xxxx

💡 Background and Solution

  • The specific problem to be addressed.
  • List the final API implementation and usage if needed.
  • If there are UI/interaction changes, consider providing screenshots or GIFs.

📝 Change Log

Language Changelog
🇺🇸 English add a close button element for semantic
🇨🇳 Chinese 为语义化增加关闭按钮元素

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 22, 2025

Preview is ready

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 22, 2025

👁 Visual Regression Report for PR #55815 Passed ✅

🎯 Target branch: feature (098b81e)
📖 View Full Report ↗︎
📖 Alternative Report ↗︎

🎊 Congrats! No visual-regression diff found.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 22, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @coding-ice, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the Ant Design Alert component by adding semantic styling capabilities for its close button. This change allows for greater customization, enabling developers to apply specific class names and styles to the close button, thereby improving the component's flexibility and adherence to design systems. The update includes modifications to the component's type definitions, internal rendering logic, and corresponding test and demo updates.

Highlights

  • Semantic Styling for Alert Close Button: Introduced a new 'close' semantic name for the Alert component, allowing developers to apply custom class names and styles directly to the close button.
  • Enhanced CloseIconNode Component: The internal CloseIconNode component now accepts 'className' and 'style' props, which are dynamically applied to the close button element using 'clsx' for flexible styling.
  • Updated Alert Component Integration: The main Alert component has been updated to pass the new 'close' semantic class names and styles to the CloseIconNode, ensuring the custom styling is correctly rendered.
  • Comprehensive Test Coverage: New test cases have been added to verify that custom class names and styles are correctly applied to the alert's close button, ensuring the new functionality works as expected.
  • Demo and Documentation Updates: The semantic demo file has been updated to include descriptions for the 'close' semantic element in both English and Chinese, and the demo alert is now explicitly 'closable' to showcase the new feature.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully adds a close semantic element to the Alert component, which is a great enhancement for customization via the classNames and styles props. The implementation is clean, and the changes are consistently applied across the component, tests, and documentation. I have one minor suggestion to improve the robustness of the new test case.

expect(titleElement).toHaveClass(customClassNames.title!);
expect(descriptionElement).toHaveClass(customClassNames.description!);
expect(actionElement).toHaveClass(customClassNames.actions!);
expect(closeElement).toHaveClass(customClassNames.close!);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve test robustness and provide clearer error messages, it's good practice to first assert that an element exists in the document before making further assertions on its properties. If closeElement were null, this test would fail with a less informative TypeError when checking for classes or styles.

Suggested change
expect(closeElement).toHaveClass(customClassNames.close!);
expect(closeElement).toBeInTheDocument();
expect(closeElement).toHaveClass(customClassNames.close!);

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Nov 22, 2025

@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 22, 2025

Bundle Report

Changes will increase total bundle size by 8.31MB (212.43%) ⬆️⚠️, exceeding the configured threshold of 5%.

Bundle name Size Change
antd.min-array-push 12.22MB 8.31MB (212.43%) ⬆️⚠️

Affected Assets, Files, and Routes:

view changes for bundle: antd.min-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
antd-with-locales.js (New) 6.42MB 6.42MB 100.0% 🚀
antd.js (New) 5.8MB 5.8MB 100.0% 🚀
antd-with-locales.min.js (Deleted) -2.15MB 0 bytes -100.0% 🗑️
antd.min.js (Deleted) -1.76MB 0 bytes -100.0% 🗑️

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Nov 24, 2025
@afc163 afc163 merged commit c4f0f4b into ant-design:feature Nov 24, 2025
38 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (098b81e) to head (10e7b7f).
⚠️ Report is 8 commits behind head on feature.

Additional details and impacted files
@@            Coverage Diff            @@
##           feature    #55815   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          803       803           
  Lines        14804     14804           
  Branches      3913      3913           
=========================================
  Hits         14804     14804           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

{ name: 'title', desc: locale.title, version: '6.0.0' },
{ name: 'description', desc: locale.description, version: '6.0.0' },
{ name: 'actions', desc: locale.actions, version: '6.0.0' },
{ name: 'close', desc: locale.close, version: '6.0.0' },
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v6 已经发布了,那现在用这个版本描述岂不是不合适

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emm, 忘记改了,等下我 fix 下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants