-
-
Notifications
You must be signed in to change notification settings - Fork 478
fix: role and aria-selected a11y error #1158
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
""" Walkthrough本次更改主要在 OptionList 组件中调整了虚拟滚动开启与否时 aria-selected 属性的应用逻辑,虚拟滚动启用时不设置该属性,关闭时正常设置。同时新增了针对虚拟滚动不同配置下 Select 组件 ARIA 属性的无障碍测试。 Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Select
participant OptionList
participant List
User->>Select: 打开下拉菜单
Select->>OptionList: 渲染选项列表
OptionList->>List: 根据 virtual 属性渲染
alt 虚拟滚动启用
List->>OptionList: 渲染 option,aria-selected 不设置
else 虚拟滚动关闭
OptionList->>List: 渲染 option,设置 aria-selected
end
Possibly related PRs
Suggested reviewers
Poem
""" Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
src/OptionList.tsxOops! Something went wrong! :( ESLint: 8.57.1 Error: Cannot read config file: /.eslintrc.js
tests/Accessibility.test.tsxOops! Something went wrong! :( ESLint: 8.57.1 Error: Cannot read config file: /.eslintrc.js
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
✨ Finishing Touches
🧪 Generate Unit Tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
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: 4
🧹 Nitpick comments (1)
tests/Accessibility.test.tsx (1)
162-163
: 将中文注释改为英文代码中的中文注释应改为英文,以保持代码库的语言一致性。
- // 每个 option 应该有 role="option" + // Each option should have role="option"Also applies to: 207-208
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
tests/__snapshots__/OptionList.test.tsx.snap
is excluded by!**/*.snap
tests/__snapshots__/Select.test.tsx.snap
is excluded by!**/*.snap
tests/__snapshots__/Tags.test.tsx.snap
is excluded by!**/*.snap
📒 Files selected for processing (2)
src/OptionList.tsx
(3 hunks)tests/Accessibility.test.tsx
(1 hunks)
🔇 Additional comments (1)
tests/Accessibility.test.tsx (1)
135-217
: 验证通过:ARIA 属性与测试预期一致在非虚拟化(virtual=false)模式下,
OptionList
会通过getItemAriaProps
和a11yOptionProps
为每个选项添加role="option"
及aria-selected
属性;
在虚拟化(virtual=true)模式下,.rc-virtual-list-holder-inner
及其子项上均不添加role
与aria-selected
,且下拉容器本身具有role="listbox"
,与测试用例完全吻合。无需对相关实现或测试进行修改。
8ba2942
to
cd5a56f
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1158 +/- ##
=======================================
Coverage 98.11% 98.11%
=======================================
Files 39 39
Lines 1483 1484 +1
Branches 449 443 -6
=======================================
+ Hits 1455 1456 +1
Misses 28 28 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit
修复
测试