-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
fix(overlay): hide from screen readers while animating #29951
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -514,7 +514,8 @@ export const present = async <OverlayPresentOptions>( | |||
|
|||
document.body.classList.add(BACKDROP_NO_SCROLL); | |||
|
|||
hideOverlaysFromScreenReaders(overlay.el); | |||
hideUnderlyingOverlaysFromScreenReaders(overlay.el); |
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.
Just changed the name to distinguish between this function and the next.
This comment was marked as duplicate.
This comment was marked as duplicate.
const hideAnimatingOverlayFromScreenReaders = (overlay: HTMLIonOverlayElement) => { | ||
if (doc === undefined) return; | ||
|
||
overlay.setAttribute('aria-hidden', 'true'); |
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.
Optional: maybe add a comment referencing where the attribute is being added. My initial thought was: when we set it here, will it ever be removed somewhere else?
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.
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.
LGTM 👍
Issue number: internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> PR #29951 would hide the overlays from screen readers while animating. This allows the element to navigate to its correct destination for screen readers to interact with. Otherwise, the focus rings would never appear. However, this ended up breaking the interaction for iOS. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Overlays are hidden from screen readers while animating only if the platform is `android`. Since the original issue only applied to Android devices. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Dev build: `8.4.1-dev.11732033492.170e160c` Test on iOS and Android devices.
Issue number: internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> When the menu is presented on an Android device, TalkBack's focus rings may appear in the wrong position due to the transition (specifically `transform` styles). This occurs because the focus rings are initially displayed at the starting position of the elements before the transition begins. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - When an overlay is being animated (presenting or dismissing), the overlay will hide from screen readers. This allows Talkback to display the focus rings on the correct position. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Dev build: `8.4.1-dev.11732305980.19d90e1c` Related to #29951
Issue number: resolves #29857
What is the current behavior?
Screen readers like Android Talkback would not have the focus ring on the correct element. For example, Talkback would announce the buttons correctly within action sheet but the focus ring was no where to be seen.
After digging around, the focus rings are located out of screen because the action sheet is mounted to the DOM out of the screen first then transitions into the screen. There are some screen readers that do not behave as expected when an element uses
transform
styles like action sheet.ion-select-missing-focus.mp4
What is the new behavior?
Does this introduce a breaking change?
Other information
Dev build: 8.3.3-dev.11729276019.194c165c
A physical Android device will be needed, the issue does not appear in simulators
Components that need to be tested because they use overlays:
How to test:
ionic cap open android
ionic cap copy && ionic cap sync