Skip to content

[codex] support semantic notification slots#385

Merged
zombieJ merged 1 commit intomasterfrom
codex/semantic-notification-slots
Apr 27, 2026
Merged

[codex] support semantic notification slots#385
zombieJ merged 1 commit intomasterfrom
codex/semantic-notification-slots

Conversation

@zombieJ
Copy link
Copy Markdown
Member

@zombieJ zombieJ commented Apr 27, 2026

Summary

  • Add title, description, and actions semantic slots to notification classNames/styles types.
  • Apply the new slots when rendering title, description, and actions content.
  • Render actions with ${noticePrefixCls}-actions instead of the bare actions class.
  • Include the new slots in NotificationList className/style merging so root config and per-notice config compose correctly.
  • Add coverage for merged semantic slots and the actions class name.

Why

antd is moving notification content rendering into @rc-component/notification and needs these semantic slots to preserve its public classNames/styles API during the migration.

This keeps the existing icon wrapper slot behavior unchanged, so antd can continue passing its with-icon layout class through classNames.wrapper when an icon exists. Role handling remains supported through existing root props.

Validation

  • npm test
  • npm run lint (passes with existing hooks warnings)
  • npm run compile (passes with existing hooks warnings)

Summary by CodeRabbit

发布说明

  • 新功能

    • 通知组件现支持自定义 role 属性,增强无障碍访问支持,默认为 alert
    • 允许对通知的标题、描述和操作按钮分别进行类名和样式自定义。
  • 测试

    • 新增单元测试验证语义化通知渲染和样式覆盖功能。

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
notification Ready Ready Preview, Comment Apr 27, 2026 9:22am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d551a154-1c76-42b6-9398-ceefe57cae4a

📥 Commits

Reviewing files that changed from the base of the PR and between bd9b38f and e890844.

📒 Files selected for processing (3)
  • src/Notification.tsx
  • src/NotificationList/index.tsx
  • tests/index.test.tsx

漫游

通知组件新增 role 属性支持及语义化增强。标题、描述和操作按钮现支持独立的 className 和样式覆盖配置。测试覆盖新增的角色传播和样式应用功能验证。

变更

对应文件 变更摘要
通知组件核心增强
src/Notification.tsx
新增 role 属性支持,设置根元素的 rolerole ?? rootProps?.role ?? 'alert'。标题、描述和操作按钮支持独立的 classNamesstyles 覆盖。操作按钮渲染重构为条件性的 actionsNode,应用专用的类名和样式。
通知列表处理扩展
src/NotificationList/index.tsx
槽位键列表显式类型定义为 NoticeClassNames 的键数组,扩展处理的槽位以包含 titledescriptionactions,使这些新槽位的合并样式输出与现有槽位一同生成。
语义化测试覆盖
tests/index.test.tsx
新增单元测试验证:role 属性从通知配置传播到 .rc-notification-notice 元素、缺省 role 值为 "alert"、全局和单个通知的语义化 classNamesstyles 正确应用到标题/描述/操作按钮等节点。

代码审查工作量估计

🎯 2 (简单) | ⏱️ ~12 分钟

建议的审查人员

  • afc163

🐰 通知有了新模样,
角色分明显轻装,
标题、描述、按钮摆,
样式独立来搭配,
语义焕然测试强!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/semantic-notification-slots

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.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.96%. Comparing base (bd9b38f) to head (e890844).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #385      +/-   ##
==========================================
+ Coverage   98.93%   98.96%   +0.02%     
==========================================
  Files          13       13              
  Lines        1316     1352      +36     
  Branches      179      183       +4     
==========================================
+ Hits         1302     1338      +36     
  Misses         14       14              

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@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 enhances the Notification component by adding support for semantic styles and class names for the title, description, and actions elements. It updates the relevant interfaces, ensures these properties are correctly applied during rendering, and includes a comprehensive test case to validate the integration of global and local styles. I have no feedback to provide.

@zombieJ zombieJ force-pushed the codex/semantic-notification-slots branch from ab193dd to e890844 Compare April 27, 2026 09:21
@zombieJ zombieJ marked this pull request as ready for review April 27, 2026 14:14
@zombieJ zombieJ merged commit 23b0fe7 into master Apr 27, 2026
9 checks passed
@zombieJ zombieJ deleted the codex/semantic-notification-slots branch April 27, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant