Repository navigation
fix(popover): expose the popover as a dialog to assistive technology - #31824
anasdahani220 wants to merge 4 commits into
Conversation
|
@anasdahani220 is attempting to deploy a commit to the Ionic Team on Vercel. A member of the Team first needs to authorize it. |
thetaPC
left a comment
There was a problem hiding this comment.
Congrats on your first contribution to Ionic Framework, and thanks for picking this up!
The fix is right that the popover needs a dialog role, but it has to sit on the content element the way ion-modal does it. Details are inline.
- Please retitle to
fix(popover): expose the popover as a dialog to assistive technology, since the role no longer goes on the host, and update "What is the new behavior?" to match. - Please also check arrow-key navigation in a dropdown popover, nested popovers, and
ion-selectwithinterface="popover", since focus now lands on the content element when the popover opens.
|
Thanks for the detailed review! I moved role and aria-modal to the content element and inherited aria-label/role like ion-modal does, then updated the tests, the title and the description. I checked keyboard navigation (↑/↓, Esc) in a dropdown popover, nested popovers, and ion-select with interface="popover", and focus lands on the content without a focus ring. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
thetaPC
left a comment
There was a problem hiding this comment.
One more thing before CI can pass: should not override keyboard interactions for textarea elements in popover.e2e.ts now fails in Firefox. With focus on the popover content, Firefox's first Tab stops on the scrollable ion-textarea before its inner textarea, the same as it does from a focused native <dialog> or ion-modal. The test covers arrow, Home and End keys, so it can focus the textarea directly instead of tabbing to it:
await expect(popover).toBeFocused();
/**
* Focus the textarea directly instead of tabbing to it. In Firefox,
* Tab from the focused popover content stops on the scrollable
* ion-textarea first, the same as it does for a native dialog.
*/
await innerNativeTextarea.focus();
await expect(innerNativeTextarea).toBeFocused();|
Thanks, that makes sense. I updated the test to focus the textarea directly, with your comment explaining the Firefox behavior. |
Issue number: resolves #31823
What is the current behavior?
ion-popoverputsaria-modal="true"on its host but norole.aria-modalis only allowed ondialogandalertdialog, so axe reportsaria-allowed-attrand screen readers don't announce the open popover as a dialog.What is the new behavior?
role="dialog"andaria-modal="true"are now set on the popover content element inside the shadow root (part="content"), the same wayion-modaldoes it. The host no longer hasaria-modal.aria-labelandroleset onion-popoveror throughhtmlAttributesare moved to the content element, so apps can still override the role or add a name.tabIndex={-1}, sopresent()moves focus to it.outline: nonekeeps it from showing a focus ring.popover-attributes.spec.tsxto check the content element, the inherited attributes, and that the host keeps neitherrolenoraria-modal.Does this introduce a breaking change?
Other information
I ran the popover spec tests locally (all pass) and Prettier/ESLint on the changed files.
I used Claude to help me find the cause and write the test.