Skip to content

Commit c3b58f1

Browse files
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/%3Ca%20href="https://github.com/user-attachments/assets/dffd8126-ec1d-4b6f-87fc-6488c7c09aab">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`
1 parent 5a73145 commit c3b58f1

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

core/src/components/action-sheet/action-sheet.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
385385
>
386386
<ion-backdrop tappable={this.backdropDismiss} />
387387

388-
<div tabindex="0"></div>
388+
<div tabindex="0" aria-hidden="true"></div>
389389

390390
<div class="action-sheet-wrapper ion-overlay-wrapper" ref={(el) => (this.wrapperEl = el)}>
391391
<div class="action-sheet-container">
@@ -446,7 +446,7 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
446446
</div>
447447
</div>
448448

449-
<div tabindex="0"></div>
449+
<div tabindex="0" aria-hidden="true"></div>
450450
</Host>
451451
);
452452
}

core/src/components/alert/alert.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ export class Alert implements ComponentInterface, OverlayInterface {
757757
>
758758
<ion-backdrop tappable={this.backdropDismiss} />
759759

760-
<div tabindex="0"></div>
760+
<div tabindex="0" aria-hidden="true"></div>
761761

762762
<div class="alert-wrapper ion-overlay-wrapper" ref={(el) => (this.wrapperEl = el)}>
763763
<div class="alert-head">
@@ -779,7 +779,7 @@ export class Alert implements ComponentInterface, OverlayInterface {
779779
{this.renderAlertButtons()}
780780
</div>
781781

782-
<div tabindex="0"></div>
782+
<div tabindex="0" aria-hidden="true"></div>
783783
</Host>
784784
);
785785
}

core/src/components/loading/loading.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ export class Loading implements ComponentInterface, OverlayInterface {
356356
>
357357
<ion-backdrop visible={this.showBackdrop} tappable={this.backdropDismiss} />
358358

359-
<div tabindex="0"></div>
359+
<div tabindex="0" aria-hidden="true"></div>
360360

361361
<div class="loading-wrapper ion-overlay-wrapper">
362362
{spinner && (
@@ -368,7 +368,7 @@ export class Loading implements ComponentInterface, OverlayInterface {
368368
{message !== undefined && this.renderLoadingMessage(msgId)}
369369
</div>
370370

371-
<div tabindex="0"></div>
371+
<div tabindex="0" aria-hidden="true"></div>
372372
</Host>
373373
);
374374
}

core/src/components/picker-legacy/picker.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ export class Picker implements ComponentInterface, OverlayInterface {
375375
>
376376
<ion-backdrop visible={this.showBackdrop} tappable={this.backdropDismiss}></ion-backdrop>
377377

378-
<div tabindex="0"></div>
378+
<div tabindex="0" aria-hidden="true"></div>
379379

380380
<div class="picker-wrapper ion-overlay-wrapper" role="dialog">
381381
<div class="picker-toolbar">
@@ -395,7 +395,7 @@ export class Picker implements ComponentInterface, OverlayInterface {
395395
</div>
396396
</div>
397397

398-
<div tabindex="0"></div>
398+
<div tabindex="0" aria-hidden="true"></div>
399399
</Host>
400400
);
401401
}

0 commit comments

Comments
 (0)