-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Mark content outside of popovers inert #145
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
Improve accessibility by hiding content outside of the modals from screen readers.
Opening a nested settings--e.g., Text color--presents a popover and moves focus to the new popover. In that case, we do not want to dismiss the block inspector housing the button that opened the popover.
Buttons rendered within popovers reside in the root body element, thus we need to hoist this global style override higher.
'is-quick': isQuick | ||
}), | ||
popoverProps: { | ||
+ ...this.props.popoverProps, |
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.
Patch to allow improving screen reader accessibility through marking the block inserter as a dialog.
<div | ||
id="popover-fallback-container" | ||
class="components-popover__fallback-container" | ||
></div> |
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.
Manually place a "fallback" popover element in the root so that we may query it via its id
attribute.
.components-button { | ||
font-size: $baseline-interactive-font-size; | ||
} |
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.
Hoist these existing styles to ensure they are applied to buttons within popovers that now render in the root body element.
useModalize( isInserterOpened ); | ||
useModalize( isBlockInspectorShown ); |
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.
Mark content outside of the block inserter and block inspector as inert, so that screen readers cannot read the content aloud when visually obscured by a modal.
Allow setting popover props for the `Inserter` component, so we can improve the mobile screen reader experience by marking it as a modal dialog.
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.
Tested and it works as described
What?
Mark content outside of the block inserter and block inspector inert.
Why?
Close #86. Close CMM-192. Without this, screen readers unexpectedly navigate content that is visually
hidden by the modal popovers.
How?
For the block inserter and block inspector:
Testing Instructions
Tip
Test using the WP-iOS prototype build.
1: Content outside of popover is inert 1
dialog—e.g., block canvas content.
2: Dismiss dialogs with iOS' two-finger scrub
Accessibility Testing Instructions
Listed in testing instructions.
Screenshots or screencast
N/A, no visual changes.
Footnotes
This also applies to Android TalkBack, but testing Android with these steps is not possible due to an existing bug: https://github.com/WordPress/gutenberg/issues/70277. ↩