fix(overlays): hide the focus trap div from screen readers (#29970)

Issue number: resolves #29858

---------

## What is the current behavior?
When swiping between elements using Android TalkBack, a green box is
shown for certain overlays and it gains focus at the beginning and end
of those overlays:

<img width="419" alt="Screenshot 2024-10-25 at 2 44 45 PM"
src="https://github.com/user-attachments/assets/dffd8126-ec1d-4b6f-87fc-6488c7c09aab">

## What is the new behavior?
The `aria-hidden` attribute is now added to the focus trap divs to hide
them from screen readers, without preventing these divs from trapping
keyboard focus.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

## Other information
Dev build: `8.3.4-dev.11729882231.1b2e7f13`
This commit is contained in:
Brandy Carney
2024-10-29 10:04:43 -04:00
committed by GitHub
parent 5a7314553a
commit c3b58f1620
4 changed files with 8 additions and 8 deletions

View File

@ -385,7 +385,7 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
> >
<ion-backdrop tappable={this.backdropDismiss} /> <ion-backdrop tappable={this.backdropDismiss} />
<div tabindex="0"></div> <div tabindex="0" aria-hidden="true"></div>
<div class="action-sheet-wrapper ion-overlay-wrapper" ref={(el) => (this.wrapperEl = el)}> <div class="action-sheet-wrapper ion-overlay-wrapper" ref={(el) => (this.wrapperEl = el)}>
<div class="action-sheet-container"> <div class="action-sheet-container">
@ -446,7 +446,7 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
</div> </div>
</div> </div>
<div tabindex="0"></div> <div tabindex="0" aria-hidden="true"></div>
</Host> </Host>
); );
} }

View File

@ -757,7 +757,7 @@ export class Alert implements ComponentInterface, OverlayInterface {
> >
<ion-backdrop tappable={this.backdropDismiss} /> <ion-backdrop tappable={this.backdropDismiss} />
<div tabindex="0"></div> <div tabindex="0" aria-hidden="true"></div>
<div class="alert-wrapper ion-overlay-wrapper" ref={(el) => (this.wrapperEl = el)}> <div class="alert-wrapper ion-overlay-wrapper" ref={(el) => (this.wrapperEl = el)}>
<div class="alert-head"> <div class="alert-head">
@ -779,7 +779,7 @@ export class Alert implements ComponentInterface, OverlayInterface {
{this.renderAlertButtons()} {this.renderAlertButtons()}
</div> </div>
<div tabindex="0"></div> <div tabindex="0" aria-hidden="true"></div>
</Host> </Host>
); );
} }

View File

@ -356,7 +356,7 @@ export class Loading implements ComponentInterface, OverlayInterface {
> >
<ion-backdrop visible={this.showBackdrop} tappable={this.backdropDismiss} /> <ion-backdrop visible={this.showBackdrop} tappable={this.backdropDismiss} />
<div tabindex="0"></div> <div tabindex="0" aria-hidden="true"></div>
<div class="loading-wrapper ion-overlay-wrapper"> <div class="loading-wrapper ion-overlay-wrapper">
{spinner && ( {spinner && (
@ -368,7 +368,7 @@ export class Loading implements ComponentInterface, OverlayInterface {
{message !== undefined && this.renderLoadingMessage(msgId)} {message !== undefined && this.renderLoadingMessage(msgId)}
</div> </div>
<div tabindex="0"></div> <div tabindex="0" aria-hidden="true"></div>
</Host> </Host>
); );
} }

View File

@ -375,7 +375,7 @@ export class Picker implements ComponentInterface, OverlayInterface {
> >
<ion-backdrop visible={this.showBackdrop} tappable={this.backdropDismiss}></ion-backdrop> <ion-backdrop visible={this.showBackdrop} tappable={this.backdropDismiss}></ion-backdrop>
<div tabindex="0"></div> <div tabindex="0" aria-hidden="true"></div>
<div class="picker-wrapper ion-overlay-wrapper" role="dialog"> <div class="picker-wrapper ion-overlay-wrapper" role="dialog">
<div class="picker-toolbar"> <div class="picker-toolbar">
@ -395,7 +395,7 @@ export class Picker implements ComponentInterface, OverlayInterface {
</div> </div>
</div> </div>
<div tabindex="0"></div> <div tabindex="0" aria-hidden="true"></div>
</Host> </Host>
); );
} }