Skip to content

fix(a11y): use aria-labelledby instead of aria-label on Modal dialog#479

Open
akinshaywai wants to merge 2 commits intothesysdev:mainfrom
akinshaywai:fix/a11y-modal-aria-labelledby
Open

fix(a11y): use aria-labelledby instead of aria-label on Modal dialog#479
akinshaywai wants to merge 2 commits intothesysdev:mainfrom
akinshaywai:fix/a11y-modal-aria-labelledby

Conversation

@akinshaywai
Copy link
Copy Markdown

Summary

The modal role="dialog" element used aria-label={title}, which duplicates the text already rendered in the visible <h2> heading. The ARIA Authoring Practices Guide recommends using aria-labelledby to reference a visible heading element instead.

Changes:

  • Added id="openui-modal-title" to the existing <h2> element
  • Replaced aria-label={title} on the dialog div with aria-labelledby="openui-modal-title"

This ensures screen readers read the actual rendered heading text rather than a separate hidden string that could drift out of sync.

Test plan

  • Open a modal with a screen reader (VoiceOver / NVDA)
  • Verify the dialog is announced with its title when it opens

The modal dialog used aria-label={title} which duplicates the visible
<h2> title text. Replaced with aria-labelledby pointing to the <h2>
element via id="openui-modal-title", following the ARIA authoring
practices recommendation to reference visible heading text rather than
duplicating it as a hidden string.
ankit-thesys
ankit-thesys previously approved these changes Apr 28, 2026
Copy link
Copy Markdown
Contributor

@ankit-thesys ankit-thesys left a comment

Choose a reason for hiding this comment

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

Looks good

@ankit-thesys ankit-thesys enabled auto-merge (squash) April 28, 2026 19:03
The h2 line with added id attribute exceeded prettier's line length.
Split the title content onto a separate line.
auto-merge was automatically disabled April 28, 2026 20:28

Head branch was pushed to by a user without write access

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.

2 participants