-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: improve a11y #292
base: master
Are you sure you want to change the base?
feat: improve a11y #292
Conversation
Walkthrough该更改修改了 Changes
Poem
Warning Rate limit exceeded@aojunhao123 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 4 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (3)src/index.tsx (3)
新增的 children 属性使得标签文本可以正确地与复选框关联,这是提高可访问性的重要改进。
将 holderRef 的类型从 HTMLElement 更改为 HTMLLabelElement 更准确地反映了组件的结构,有助于在编译时捕获潜在的类型错误。 Line range hint 将复选框和相关内容包装在 label 元素中的改动:
建议添加一些自动化测试来验证可访问性改进。 Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@afc163 大佬有空帮忙看一下 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #292 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 30 31 +1
Branches 5 6 +1
=========================================
+ Hits 30 31 +1 ☔ View full report in Codecov by Sentry. |
这样不行,children 也要在 label 内容,不然文字和 checkbox 关联不上。 要下沉就要把 children 也下沉。 |
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
src/index.tsx (1)
41-41
: 建议为 children 属性添加类型注解为了提高代码的类型安全性和可维护性,建议为新增的 children 属性添加明确的类型注解。
- children, + children?: React.ReactNode,
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
src/index.tsx
(2 hunks)
🔇 Additional comments (1)
src/index.tsx (1)
46-46
: 将 holderRef 类型更改为 HTMLLabelElement 是个很好的改进
这个类型更改使得类型定义更加精确,与新的 label 包装结构相匹配,同时也有助于提供更好的类型检查和IDE支持。
由于input外层包了span标签,导致a11y测试无法通过。
这个pr将label标签下沉到了rc-checkbox内部,ant-design侧的改动细节在这个commit
Summary by CodeRabbit
新功能
<label>
元素替代<span>
,提高了可访问性。children
属性,允许在复选框组件内渲染子元素。改进
holderRef
的类型,以确保复选框与其标签之间的正确关联。