Skip to content

feat: accessibility improvements#363

Open
jon-cullison wants to merge 8 commits into
react-component:masterfrom
jon-cullison:master
Open

feat: accessibility improvements#363
jon-cullison wants to merge 8 commits into
react-component:masterfrom
jon-cullison:master

Conversation

@jon-cullison
Copy link
Copy Markdown

@jon-cullison jon-cullison commented Apr 10, 2025

Implements 2/3 of the proposed changes here:
ant-design/ant-design#53203

I did not implement the panel role change because there is already some logic around setting the panel role to "tabpanel" when in accordion mode, and the panel role = "region" is optional for a11y purposes.

  • Adds optional headingLevel prop which will wrap the collapse header in a header element
  • Adds a default id generated by uuid to the collapse which will be used to create ids for the child components in order to link the header and panel.
  • Adds optional id prop which will override the default id mentioned above

Summary by CodeRabbit

  • Style

    • 优化折叠组件头部样式,确保标准与禁用状态下显示统一。
  • 新功能

    • 引入自动生成唯一标识符功能,支持自定义 ID,提升组件稳定性与无障碍体验。
    • 增加了设置标题层级的选项,使显示层次更灵活友好。
    • 折叠面板头部增加 ARIA 角色与属性,增强无障碍支持。
  • Tests

    • 扩展了测试覆盖,验证 ID 与标题层级功能的正确性,从而提升了整体可靠性。

Loading
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.

4 participants