Skip to content

[Flyout System] Automatic aria-labelledby referencing the EuiFlyoutMenu title ID#9073

Merged
tsullivan merged 3 commits intoelastic:feat/flyout-systemfrom
tsullivan:flyout-system/migration-improvements-aria-labelledby
Oct 3, 2025
Merged

[Flyout System] Automatic aria-labelledby referencing the EuiFlyoutMenu title ID#9073
tsullivan merged 3 commits intoelastic:feat/flyout-systemfrom
tsullivan:flyout-system/migration-improvements-aria-labelledby

Conversation

@tsullivan
Copy link
Copy Markdown
Member

@tsullivan tsullivan commented Oct 1, 2025

Summary

This PR implements automatic ARIA labeling for flyouts with menus.

Why are we making this change?

  1. This change makes it easier for developers to have a correct parent-child labeling relationships between flyout containers and their titles.
  2. Developers can provide a custom aria-labelledby value to their flyout, or a custom titleId value in flyoutMenuProps if needed.

Impact to users

  1. Existing flyouts continue to work without code changes.

  2. Developers that migrate EuiFlyout instances to use the session=true prop will not have to do extra work to carry over proper ARIA labeling.

    Consider the following diff. The "before" code manually constructs an ARIA label relationship between the EuiFlyout component and the h2. In the "after" code, that manual construction is not necessary, as the flyout title is taken from flyoutMenuProps. The changes in this PR ensure that the correct ARIA label relationship happens automatically.

    -   <EuiFlyout ownFocus onClose={onClose} size="s" aria-labelledby={titleId}>
    -     <EuiFlyoutHeader hasBorder>
    -       <EuiTitle size="m">
    -         <h2 id={titleId}>{i18nTexts.diagnosticsFlyoutTitle}</h2>
    -       </EuiTitle>
    -     </EuiFlyoutHeader>
    +   <EuiFlyout
    +     ownFocus
    +     onClose={onClose}
    +     size="s"
    +     session={true}
    +     flyoutMenuProps={{ title: i18nTexts.diagnosticsFlyoutTitle }}
    +   >

QA

Remove or strikethrough items that do not apply to your PR.

General checklist

  • Browser QA
    • Checked in both light and dark modes
    • Checked in both MacOS and Windows high contrast modes
    • Checked in mobile
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA
  • Code quality checklist
  • Release checklist
    • A changelog entry exists and is marked appropriately.
    • If applicable, added the breaking change issue label (and filled out the breaking change checklist)
  • Designer checklist
    • If applicable, file an issue to update EUI's Figma library with any corresponding UI changes. (This is an internal repo, if you are external to Elastic, ask a maintainer to submit this request)

@tsullivan tsullivan changed the title Automatic aria-labelledby referencing the EuiFlyoutMenu title ID [Flyout System] Automatic aria-labelledby referencing the EuiFlyoutMenu title ID Oct 1, 2025
@tsullivan tsullivan force-pushed the flyout-system/migration-improvements-aria-labelledby branch from dfe5e4c to 717c0fe Compare October 1, 2025 22:34
@tsullivan tsullivan added the skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation) label Oct 1, 2025
@tsullivan tsullivan marked this pull request as ready for review October 1, 2025 22:55
@tsullivan tsullivan requested a review from a team as a code owner October 1, 2025 22:55
@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

@tkajtoch tkajtoch self-requested a review October 3, 2025 12:53
Copy link
Copy Markdown
Member

@tkajtoch tkajtoch left a comment

Choose a reason for hiding this comment

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

Changes look good and work as expected. Thank you for making the developer experience better!

@tsullivan tsullivan merged commit 75528cf into elastic:feat/flyout-system Oct 3, 2025
4 checks passed
@tsullivan tsullivan deleted the flyout-system/migration-improvements-aria-labelledby branch October 3, 2025 16:35
@tsullivan
Copy link
Copy Markdown
Member Author

@clintandrewhall mentioned an enhancement on top could be to eliminate the need for the flyoutMenuProps and setting the title in there, by just reading the aria-labelledby on the EuiFlyout component. The Flyout System could do document.getElementById and get the text of the element which represents the label and use that as the title for the history popover.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants