Skip to content

Commit 36fe7f1

Browse files
committed
test(ac): move to overlays
1 parent 294f665 commit 36fe7f1

File tree

5 files changed

+35
-58
lines changed

5 files changed

+35
-58
lines changed

core/src/components/action-sheet/action-sheet.ios.scss

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,27 +111,23 @@
111111
// Border is made with a linear gradient in order
112112
// to get the proper color and iOS blur effect
113113

114-
.action-sheet-head {
114+
.action-sheet-title {
115115
background: $action-sheet-ios-button-background;
116116
}
117117

118-
// iOS Action Sheet Header
119-
// --------------------------------------------------
120-
121-
.action-sheet-head {
122-
@include padding($action-sheet-ios-title-padding-top, $action-sheet-ios-title-padding-end, $action-sheet-ios-title-padding-bottom, $action-sheet-ios-title-padding-start);
123-
124-
color: var(--color, $action-sheet-ios-title-color);
125-
126-
text-align: $action-sheet-ios-text-align;
127-
}
128118

129119
// iOS Action Sheet Title
130120
// ---------------------------------------------------
131121

132122
.action-sheet-title {
123+
@include padding($action-sheet-ios-title-padding-top, $action-sheet-ios-title-padding-end, $action-sheet-ios-title-padding-bottom, $action-sheet-ios-title-padding-start);
124+
125+
color: var(--color, $action-sheet-ios-title-color);
126+
133127
font-size: $action-sheet-ios-title-font-size;
134128
font-weight: $action-sheet-ios-title-font-weight;
129+
130+
text-align: $action-sheet-ios-text-align;
135131
}
136132

137133
.action-sheet-title.action-sheet-has-sub-title {

core/src/components/action-sheet/action-sheet.md.scss

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,16 @@
2929
@include margin(var(--ion-safe-area-top, 0), auto, 0, auto);
3030
}
3131

32-
// Material Design Action Sheet Header
33-
// --------------------------------------------------
34-
35-
.action-sheet-head {
32+
.action-sheet-title {
3633
@include padding($action-sheet-md-title-padding-top, $action-sheet-md-title-padding-end, $action-sheet-md-title-padding-bottom, $action-sheet-md-title-padding-start);
3734

3835
min-height: $action-sheet-md-title-height;
3936

4037
color: var(--color, $action-sheet-md-title-color);
4138

42-
text-align: $action-sheet-md-text-align;
43-
}
44-
45-
.action-sheet-title {
4639
font-size: $action-sheet-md-title-font-size;
40+
41+
text-align: $action-sheet-md-text-align;
4742
}
4843

4944
.action-sheet-sub-title {

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,6 @@
8585
pointer-events: none;
8686
}
8787

88-
.action-sheet-title,
89-
.action-sheet-sub-title {
90-
font-weight: normal;
91-
}
92-
93-
.action-sheet-title {
94-
@include margin(0);
95-
@include padding(0);
96-
}
97-
98-
.action-sheet-sub-title {
99-
@include margin(0, 0, 0);
100-
@include padding(0);
101-
}
102-
10388
.action-sheet-button {
10489
display: block;
10590
position: relative;

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

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,10 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
201201
async present(): Promise<void> {
202202
const unlock = await this.lockController.lock();
203203

204-
// hide from screen readers before animating
205-
// this is to avoid reading the action sheet content
206-
// before it's fully visible
207-
this.el.setAttribute('aria-hidden', 'true');
208-
209204
await this.delegateController.attachViewToDom();
210205

211206
await present(this, 'actionSheetEnter', iosEnterAnimation, mdEnterAnimation);
212207

213-
// show to screen readers after animation
214-
this.el.removeAttribute('aria-hidden');
215-
216208
unlock();
217209
}
218210

@@ -398,20 +390,16 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
398390
<div class="action-sheet-wrapper ion-overlay-wrapper" ref={(el) => (this.wrapperEl = el)}>
399391
<div class="action-sheet-container">
400392
<div class="action-sheet-group" ref={(el) => (this.groupEl = el)}>
401-
{(header || this.subHeader) && (
402-
<div class="action-sheet-head">
403-
{header && (
404-
<h2
405-
id={headerID}
406-
class={{
407-
'action-sheet-title': true,
408-
'action-sheet-has-sub-title': this.subHeader !== undefined,
409-
}}
410-
>
411-
{header}
412-
</h2>
413-
)}
414-
{this.subHeader && <h2 class="action-sheet-sub-title">{this.subHeader}</h2>}
393+
{header !== undefined && (
394+
<div
395+
id={headerID}
396+
class={{
397+
'action-sheet-title': true,
398+
'action-sheet-has-sub-title': this.subHeader !== undefined,
399+
}}
400+
>
401+
{header}
402+
{this.subHeader && <div class="action-sheet-sub-title">{this.subHeader}</div>}
415403
</div>
416404
)}
417405
{buttons.map((b) => (

core/src/utils/overlays.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,20 @@ export const present = async <OverlayPresentOptions>(
514514

515515
document.body.classList.add(BACKDROP_NO_SCROLL);
516516

517-
hideOverlaysFromScreenReaders(overlay.el);
517+
hideUnderlyingOverlaysFromScreenReaders(overlay.el);
518+
519+
/**
520+
* Set aria-hidden="true" to hide the overlay from screen readers
521+
* during the animation. This ensures that assistive technologies
522+
* like TalkBack do not announce or interact with the content until
523+
* the animation is complete, avoiding confusion for users.
524+
*
525+
* Additionally, it prevents focus rings from appearing in incorrect
526+
* positions due to the transition (specifically `transform` styles),
527+
* ensuring that when aria-hidden is removed, the focus rings are
528+
* correctly displayed in the final location of the elements.
529+
*/
530+
overlay.el.setAttribute('aria-hidden', 'true');
518531

519532
overlay.presented = true;
520533
overlay.willPresent.emit();
@@ -939,7 +952,7 @@ export const createTriggerController = () => {
939952
* @param newTopMostOverlay - The overlay that is being presented. Since the overlay has not been
940953
* fully presented yet at the time this function is called it will not be included in the getPresentedOverlays result.
941954
*/
942-
const hideOverlaysFromScreenReaders = (newTopMostOverlay: HTMLIonOverlayElement) => {
955+
const hideUnderlyingOverlaysFromScreenReaders = (newTopMostOverlay: HTMLIonOverlayElement) => {
943956
if (doc === undefined) return;
944957

945958
const overlays = getPresentedOverlays(doc);

0 commit comments

Comments
 (0)