Skip to content

Commit

Permalink
fix(overlays): hide the focus trap div from screen readers (#29970)
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
brandyscarney authored Oct 29, 2024
1 parent 5a73145 commit c3b58f1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions core/src/components/action-sheet/action-sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
>
<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-container">
Expand Down Expand Up @@ -446,7 +446,7 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
</div>
</div>

<div tabindex="0"></div>
<div tabindex="0" aria-hidden="true"></div>
</Host>
);
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/alert/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ export class Alert implements ComponentInterface, OverlayInterface {
>
<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-head">
Expand All @@ -779,7 +779,7 @@ export class Alert implements ComponentInterface, OverlayInterface {
{this.renderAlertButtons()}
</div>

<div tabindex="0"></div>
<div tabindex="0" aria-hidden="true"></div>
</Host>
);
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/loading/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ export class Loading implements ComponentInterface, OverlayInterface {
>
<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">
{spinner && (
Expand All @@ -368,7 +368,7 @@ export class Loading implements ComponentInterface, OverlayInterface {
{message !== undefined && this.renderLoadingMessage(msgId)}
</div>

<div tabindex="0"></div>
<div tabindex="0" aria-hidden="true"></div>
</Host>
);
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/picker-legacy/picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ export class Picker implements ComponentInterface, OverlayInterface {
>
<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-toolbar">
Expand All @@ -395,7 +395,7 @@ export class Picker implements ComponentInterface, OverlayInterface {
</div>
</div>

<div tabindex="0"></div>
<div tabindex="0" aria-hidden="true"></div>
</Host>
);
}
Expand Down

0 comments on commit c3b58f1

Please sign in to comment.