@ionic/core 9.0.1-dev.11788212611.154b1596 → 9.0.1-dev.11788375537.1f38f077
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/index.js +1 -1
- package/components/ion-action-sheet.js +1 -1
- package/components/ion-alert.js +1 -1
- package/components/ion-content.js +1 -1
- package/components/ion-datetime.js +1 -1
- package/components/ion-loading.js +1 -1
- package/components/ion-menu.js +1 -1
- package/components/ion-modal.js +1 -1
- package/components/ion-popover.js +1 -1
- package/components/ion-select-modal.js +1 -1
- package/components/ion-select-popover.js +1 -1
- package/components/ion-select.js +1 -1
- package/components/ion-toast.js +1 -1
- package/components/p-CXQzYyda.js +4 -0
- package/components/p-D6PwfJ9F.js +4 -0
- package/components/{p-CxiXpCtB.js → p-D6dNJoqU.js} +1 -1
- package/components/p-D8BOfNYz.js +4 -0
- package/components/{p-Dq1-WhnV.js → p-Dcxr2vKX.js} +1 -1
- package/components/p-FQTgh7aH.js +4 -0
- package/components/p-KusMkAnB.js +4 -0
- package/components/p-U1X_lw_6.js +4 -0
- package/css/core.css +1 -1
- package/css/core.css.map +1 -1
- package/css/ionic.bundle.css +1 -1
- package/css/ionic.bundle.css.map +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/ion-action-sheet.cjs.entry.js +20 -36
- package/dist/cjs/ion-alert.cjs.entry.js +12 -20
- package/dist/cjs/ion-app_8.cjs.entry.js +4 -81
- package/dist/cjs/ion-datetime.cjs.entry.js +1 -1
- package/dist/cjs/ion-loading.cjs.entry.js +3 -7
- package/dist/cjs/ion-menu_3.cjs.entry.js +1 -1
- package/dist/cjs/ion-modal.cjs.entry.js +24 -77
- package/dist/cjs/ion-popover.cjs.entry.js +3 -16
- package/dist/cjs/ion-select-modal.cjs.entry.js +1 -1
- package/dist/cjs/ion-select_3.cjs.entry.js +1 -1
- package/dist/cjs/ion-toast.cjs.entry.js +1 -1
- package/dist/cjs/{overlays-HN9joo1Z.js → overlays-hCtsdAvn.js} +29 -54
- package/dist/collection/components/action-sheet/action-sheet.js +20 -36
- package/dist/collection/components/alert/alert.js +12 -20
- package/dist/collection/components/content/content.js +4 -81
- package/dist/collection/components/loading/loading.js +3 -7
- package/dist/collection/components/modal/modal.ios.css +1 -12
- package/dist/collection/components/modal/modal.js +22 -75
- package/dist/collection/components/modal/modal.md.css +1 -12
- package/dist/collection/components/popover/popover.js +3 -16
- package/dist/collection/utils/overlays.js +29 -53
- package/dist/collection/utils/test/playwright/index.js +0 -1
- package/dist/docs.json +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/ion-action-sheet.entry.js +20 -36
- package/dist/esm/ion-alert.entry.js +12 -20
- package/dist/esm/ion-app_8.entry.js +4 -81
- package/dist/esm/ion-datetime.entry.js +1 -1
- package/dist/esm/ion-loading.entry.js +3 -7
- package/dist/esm/ion-menu_3.entry.js +1 -1
- package/dist/esm/ion-modal.entry.js +24 -77
- package/dist/esm/ion-popover.entry.js +3 -16
- package/dist/esm/ion-select-modal.entry.js +1 -1
- package/dist/esm/ion-select_3.entry.js +1 -1
- package/dist/esm/ion-toast.entry.js +1 -1
- package/dist/esm/{overlays-Dz2cGX5q.js → overlays-CiFoZEq1.js} +30 -54
- package/dist/ionic/index.esm.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-39415b06.entry.js +4 -0
- package/dist/ionic/p-3bad6750.entry.js +4 -0
- package/dist/ionic/{p-0c2b3555.entry.js → p-4dcd329a.entry.js} +1 -1
- package/dist/ionic/{p-025763b2.entry.js → p-5fce4bf4.entry.js} +1 -1
- package/dist/ionic/p-70334101.entry.js +4 -0
- package/dist/ionic/p-8db6e422.entry.js +4 -0
- package/dist/ionic/{p-90e06e60.entry.js → p-986a1db8.entry.js} +1 -1
- package/dist/ionic/p-DA52akcQ.js +4 -0
- package/dist/ionic/p-b62c04b2.entry.js +4 -0
- package/dist/ionic/{p-9fef333a.entry.js → p-da5a7bcd.entry.js} +1 -1
- package/dist/ionic/p-e090eca3.entry.js +4 -0
- package/dist/ionic/{p-bdc01880.entry.js → p-e5a54d99.entry.js} +1 -1
- package/dist/types/components/action-sheet/action-sheet.d.ts +0 -10
- package/dist/types/components/alert/alert.d.ts +0 -7
- package/dist/types/components/content/content.d.ts +0 -24
- package/dist/types/components/modal/modal.d.ts +0 -8
- package/dist/types/utils/overlays.d.ts +0 -9
- package/dist/types/utils/test/playwright/index.d.ts +0 -1
- package/hydrate/index.js +90 -268
- package/hydrate/index.mjs +90 -268
- package/package.json +1 -1
- package/components/p-C8Tp0cQy.js +0 -4
- package/components/p-CVNvmbDp.js +0 -4
- package/components/p-D2XJVty5.js +0 -4
- package/components/p-D49fFp1g.js +0 -4
- package/components/p-DALTMT_o.js +0 -4
- package/components/p-z-BF3clL.js +0 -4
- package/dist/collection/utils/test/playwright/detach-reattach.js +0 -23
- package/dist/ionic/p-010601fe.entry.js +0 -4
- package/dist/ionic/p-26911da5.entry.js +0 -4
- package/dist/ionic/p-4778b90f.entry.js +0 -4
- package/dist/ionic/p-7dec112e.entry.js +0 -4
- package/dist/ionic/p-d85e59b1.entry.js +0 -4
- package/dist/ionic/p-dad2f3e4.entry.js +0 -4
- package/dist/ionic/p-nxFQkv7U.js +0 -4
- package/dist/types/utils/test/playwright/detach-reattach.d.ts +0 -13
|
@@ -102,15 +102,6 @@ const activeAnimations = new WeakMap();
|
|
|
102
102
|
const isBackdropAlwaysBlocking = (el) => {
|
|
103
103
|
return el.showBackdrop !== false && !((el.backdropBreakpoint ?? 0) > 0);
|
|
104
104
|
};
|
|
105
|
-
/**
|
|
106
|
-
* Whether the overlay takes the app root out of the accessibility tree and
|
|
107
|
-
* blocks body scroll while presented. Toasts never do, modal and popover can
|
|
108
|
-
* opt out with `focusTrap={false}`, and a backdrop that does not block
|
|
109
|
-
* (`showBackdrop={false}`, or a `backdropBreakpoint` above 0) is excluded.
|
|
110
|
-
*/
|
|
111
|
-
const locksAppRoot = (el) => {
|
|
112
|
-
return el.tagName !== 'ION-TOAST' && el.focusTrap !== false && isBackdropAlwaysBlocking(el);
|
|
113
|
-
};
|
|
114
105
|
const createController = (tagName) => {
|
|
115
106
|
return {
|
|
116
107
|
create(options) {
|
|
@@ -481,13 +472,6 @@ const getPresentedOverlay = (doc, overlayTag, id) => {
|
|
|
481
472
|
// Otherwise, return the last overlay with the given id
|
|
482
473
|
return (id === undefined ? overlays : overlays.filter((o) => o.id === id)).slice(-1)[0];
|
|
483
474
|
};
|
|
484
|
-
/**
|
|
485
|
-
* The element an app nests its views under. Overlays hide this rather than the
|
|
486
|
-
* whole root, so the overlay itself (a sibling) stays reachable.
|
|
487
|
-
*/
|
|
488
|
-
const getViewContainer = () => {
|
|
489
|
-
return getAppRoot(document).querySelector('ion-router-outlet, #ion-view-container-root');
|
|
490
|
-
};
|
|
491
475
|
/**
|
|
492
476
|
* When an overlay is presented, the main
|
|
493
477
|
* focus is the overlay not the page content.
|
|
@@ -511,7 +495,8 @@ const getViewContainer = () => {
|
|
|
511
495
|
* for main content.
|
|
512
496
|
*/
|
|
513
497
|
const setRootAriaHidden = (hidden = false) => {
|
|
514
|
-
const
|
|
498
|
+
const root = getAppRoot(document);
|
|
499
|
+
const viewContainer = root.querySelector('ion-router-outlet, #ion-view-container-root');
|
|
515
500
|
if (!viewContainer) {
|
|
516
501
|
return;
|
|
517
502
|
}
|
|
@@ -536,42 +521,15 @@ const cleanupRootFocusTrapAccessibility = () => {
|
|
|
536
521
|
return;
|
|
537
522
|
}
|
|
538
523
|
const remainingOverlays = getPresentedOverlays(document);
|
|
539
|
-
const hasRemainingLocking = remainingOverlays.some((o) =>
|
|
524
|
+
const hasRemainingLocking = remainingOverlays.some((o) => {
|
|
525
|
+
const el = o;
|
|
526
|
+
return el.tagName !== 'ION-TOAST' && el.focusTrap !== false && isBackdropAlwaysBlocking(el);
|
|
527
|
+
});
|
|
540
528
|
if (!hasRemainingLocking) {
|
|
541
529
|
setRootAriaHidden(false);
|
|
542
530
|
document.body.classList.remove(gestureController.BACKDROP_NO_SCROLL);
|
|
543
531
|
}
|
|
544
532
|
};
|
|
545
|
-
/**
|
|
546
|
-
* Applies the root lock itself: `aria-hidden` on the view container, and
|
|
547
|
-
* `backdrop-no-scroll` on the body. Shared by `present()` and the restore
|
|
548
|
-
* below, which have to stay in lockstep.
|
|
549
|
-
*/
|
|
550
|
-
const applyRootLock = (el) => {
|
|
551
|
-
// Hiding the container the overlay now sits in would hide the overlay too.
|
|
552
|
-
if (!getViewContainer()?.contains(el)) {
|
|
553
|
-
setRootAriaHidden(true);
|
|
554
|
-
}
|
|
555
|
-
document.body.classList.add(gestureController.BACKDROP_NO_SCROLL);
|
|
556
|
-
};
|
|
557
|
-
/**
|
|
558
|
-
* Re-applies the root lock that `cleanupRootFocusTrapAccessibility()` released.
|
|
559
|
-
* Call from `connectedCallback` when the overlay is still presented.
|
|
560
|
-
*
|
|
561
|
-
* A synchronous move keeps the overlay connected, so the lock survives. A
|
|
562
|
-
* detach with a re-insert in a later task releases it, which is the shape a
|
|
563
|
-
* framework produces when it takes a subtree out and puts it back.
|
|
564
|
-
*/
|
|
565
|
-
const restoreRootFocusTrapAccessibility = (overlayEl) => {
|
|
566
|
-
if (typeof document === 'undefined') {
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
569
|
-
const el = overlayEl;
|
|
570
|
-
if (!locksAppRoot(el)) {
|
|
571
|
-
return;
|
|
572
|
-
}
|
|
573
|
-
applyRootLock(el);
|
|
574
|
-
};
|
|
575
533
|
const present = async (overlay, name, iosEnterAnimation, mdEnterAnimation, opts) => {
|
|
576
534
|
if (overlay.presented) {
|
|
577
535
|
return;
|
|
@@ -588,7 +546,15 @@ const present = async (overlay, name, iosEnterAnimation, mdEnterAnimation, opts)
|
|
|
588
546
|
restoreElementFocus(overlay.el);
|
|
589
547
|
}
|
|
590
548
|
/**
|
|
591
|
-
*
|
|
549
|
+
* Due to accessibility guidelines, toasts do not have
|
|
550
|
+
* focus traps.
|
|
551
|
+
*
|
|
552
|
+
* All other overlays should have focus traps to prevent
|
|
553
|
+
* the keyboard focus from leaving the overlay unless
|
|
554
|
+
* developers explicitly opt out (for example, sheet
|
|
555
|
+
* modals that should permit background interaction).
|
|
556
|
+
*
|
|
557
|
+
* Note: Some apps move inline overlays to a specific container
|
|
592
558
|
* during the willPresent lifecycle (e.g., React portals via
|
|
593
559
|
* onWillPresent). Defer applying aria-hidden/inert to the app
|
|
594
560
|
* root until after willPresent so we can detect where the
|
|
@@ -597,11 +563,18 @@ const present = async (overlay, name, iosEnterAnimation, mdEnterAnimation, opts)
|
|
|
597
563
|
* to avoid disabling the overlay.
|
|
598
564
|
*/
|
|
599
565
|
const overlayEl = overlay.el;
|
|
600
|
-
const
|
|
566
|
+
const shouldTrapFocus = overlayEl.tagName !== 'ION-TOAST' && overlayEl.focusTrap !== false;
|
|
567
|
+
const shouldLockRoot = shouldTrapFocus && isBackdropAlwaysBlocking(overlayEl);
|
|
601
568
|
overlay.presented = true;
|
|
602
569
|
overlay.willPresent.emit();
|
|
603
570
|
if (shouldLockRoot) {
|
|
604
|
-
|
|
571
|
+
const root = getAppRoot(document);
|
|
572
|
+
const viewContainer = root.querySelector('ion-router-outlet, #ion-view-container-root');
|
|
573
|
+
const overlayInsideViewContainer = viewContainer ? viewContainer.contains(overlayEl) : false;
|
|
574
|
+
if (!overlayInsideViewContainer) {
|
|
575
|
+
setRootAriaHidden(true);
|
|
576
|
+
}
|
|
577
|
+
document.body.classList.add(gestureController.BACKDROP_NO_SCROLL);
|
|
605
578
|
}
|
|
606
579
|
overlay.willPresentShorthand?.emit();
|
|
607
580
|
const mode = ionicGlobal.getIonMode(overlay);
|
|
@@ -727,9 +700,12 @@ const dismiss = async (overlay, data, role, name, iosLeaveAnimation, mdLeaveAnim
|
|
|
727
700
|
* from the root element when the last focus-trapping overlay
|
|
728
701
|
* is dismissed.
|
|
729
702
|
*/
|
|
730
|
-
const overlaysLockingRoot = presentedOverlays.filter((o) =>
|
|
703
|
+
const overlaysLockingRoot = presentedOverlays.filter((o) => {
|
|
704
|
+
const el = o;
|
|
705
|
+
return el.tagName !== 'ION-TOAST' && el.focusTrap !== false && isBackdropAlwaysBlocking(el);
|
|
706
|
+
});
|
|
731
707
|
const overlayEl = overlay.el;
|
|
732
|
-
const locksRoot =
|
|
708
|
+
const locksRoot = overlayEl.tagName !== 'ION-TOAST' && overlayEl.focusTrap !== false && isBackdropAlwaysBlocking(overlayEl);
|
|
733
709
|
/**
|
|
734
710
|
* If this is the last visible overlay that is trapping focus
|
|
735
711
|
* then we want to re-add the root to the accessibility tree.
|
|
@@ -996,7 +972,6 @@ exports.modalController = modalController;
|
|
|
996
972
|
exports.popoverController = popoverController;
|
|
997
973
|
exports.prepareOverlay = prepareOverlay;
|
|
998
974
|
exports.present = present;
|
|
999
|
-
exports.restoreRootFocusTrapAccessibility = restoreRootFocusTrapAccessibility;
|
|
1000
975
|
exports.safeCall = safeCall;
|
|
1001
976
|
exports.setOverlayId = setOverlayId;
|
|
1002
977
|
exports.toastController = toastController;
|
|
@@ -5,7 +5,7 @@ import { Host, h, readTask } from "@stencil/core";
|
|
|
5
5
|
import { createButtonActiveGesture } from "../../utils/gesture/button-active";
|
|
6
6
|
import { raf } from "../../utils/helpers";
|
|
7
7
|
import { createLockController } from "../../utils/lock-controller";
|
|
8
|
-
import { BACKDROP, cleanupRootFocusTrapAccessibility, createDelegateController, createTriggerController, dismiss, eventMethod, isCancel, prepareOverlay, present,
|
|
8
|
+
import { BACKDROP, cleanupRootFocusTrapAccessibility, createDelegateController, createTriggerController, dismiss, eventMethod, isCancel, prepareOverlay, present, safeCall, setOverlayId, } from "../../utils/overlays";
|
|
9
9
|
import { renderOptionLabel } from "../../utils/select-option-render";
|
|
10
10
|
import { getClassMap } from "../../utils/theme";
|
|
11
11
|
import { getIonMode } from "../../global/ionic-global";
|
|
@@ -277,13 +277,6 @@ export class ActionSheet {
|
|
|
277
277
|
connectedCallback() {
|
|
278
278
|
prepareOverlay(this.el);
|
|
279
279
|
this.triggerChanged();
|
|
280
|
-
// `componentDidLoad` only fires once per instance, so a reconnect has to
|
|
281
|
-
// rebuild the gesture its disconnect destroyed.
|
|
282
|
-
this.setupButtonActiveGesture();
|
|
283
|
-
// Re-apply the root lock if moved without dismiss() being called
|
|
284
|
-
if (this.presented) {
|
|
285
|
-
restoreRootFocusTrapAccessibility(this.el);
|
|
286
|
-
}
|
|
287
280
|
}
|
|
288
281
|
disconnectedCallback() {
|
|
289
282
|
if (this.gesture) {
|
|
@@ -303,33 +296,24 @@ export class ActionSheet {
|
|
|
303
296
|
// Initialize activeRadioId for radio buttons
|
|
304
297
|
this.buttonsChanged();
|
|
305
298
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
*/
|
|
315
|
-
setupButtonActiveGesture() {
|
|
299
|
+
componentDidLoad() {
|
|
300
|
+
/**
|
|
301
|
+
* Only create gesture if:
|
|
302
|
+
* 1. A gesture does not already exist
|
|
303
|
+
* 2. App is running in iOS mode
|
|
304
|
+
* 3. A wrapper ref exists
|
|
305
|
+
* 4. A group ref exists
|
|
306
|
+
*/
|
|
316
307
|
const { groupEl, wrapperEl } = this;
|
|
317
|
-
if (getIonMode(this)
|
|
318
|
-
|
|
308
|
+
if (!this.gesture && getIonMode(this) === 'ios' && wrapperEl && groupEl) {
|
|
309
|
+
readTask(() => {
|
|
310
|
+
const isScrollable = groupEl.scrollHeight > groupEl.clientHeight;
|
|
311
|
+
if (!isScrollable) {
|
|
312
|
+
this.gesture = createButtonActiveGesture(wrapperEl, (refEl) => refEl.classList.contains('action-sheet-button'));
|
|
313
|
+
this.gesture.enable(true);
|
|
314
|
+
}
|
|
315
|
+
});
|
|
319
316
|
}
|
|
320
|
-
readTask(() => {
|
|
321
|
-
// Bail if a call queued ahead of this one already built the gesture
|
|
322
|
-
// (a second would orphan the first with its listeners still bound), if
|
|
323
|
-
// the host disconnected while this task waited, or if the group scrolls.
|
|
324
|
-
if (this.gesture || !this.el.isConnected || groupEl.scrollHeight > groupEl.clientHeight) {
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
this.gesture = createButtonActiveGesture(wrapperEl, (refEl) => refEl.classList.contains('action-sheet-button'));
|
|
328
|
-
this.gesture.enable(true);
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
componentDidLoad() {
|
|
332
|
-
this.setupButtonActiveGesture();
|
|
333
317
|
/**
|
|
334
318
|
* If action sheet was rendered with isOpen="true"
|
|
335
319
|
* then we should open action sheet immediately.
|
|
@@ -422,17 +406,17 @@ export class ActionSheet {
|
|
|
422
406
|
const cancelButton = allButtons.find((b) => b.role === 'cancel');
|
|
423
407
|
const buttons = allButtons.filter((b) => b.role !== 'cancel');
|
|
424
408
|
const headerID = `action-sheet-${overlayIndex}-header`;
|
|
425
|
-
return (h(Host, { key: '
|
|
409
|
+
return (h(Host, { key: '7685831da9a78b73473246a2cea95cefa79a53c3', role: "dialog", "aria-modal": "true", "aria-labelledby": header !== undefined ? headerID : null, tabindex: "-1", ...htmlAttributes, style: {
|
|
426
410
|
zIndex: `${20000 + this.overlayIndex}`,
|
|
427
411
|
}, class: {
|
|
428
412
|
[mode]: true,
|
|
429
413
|
...getClassMap(this.cssClass),
|
|
430
414
|
'overlay-hidden': true,
|
|
431
415
|
'action-sheet-translucent': this.translucent,
|
|
432
|
-
}, onIonActionSheetWillDismiss: this.dispatchCancelHandler, onIonBackdropTap: this.onBackdropTap }, h("ion-backdrop", { key: '
|
|
416
|
+
}, onIonActionSheetWillDismiss: this.dispatchCancelHandler, onIonBackdropTap: this.onBackdropTap }, h("ion-backdrop", { key: 'c70f00e401cac99b89412d1adb867f35bc855d57', tappable: this.backdropDismiss }), h("div", { key: '3332893ce3098f1435875480b1269b2821d41660', tabindex: "0", "aria-hidden": "true" }), h("div", { key: 'eb406b0a9e303d6f94c5c7aa99c6f4c089bfbd41', class: "action-sheet-wrapper ion-overlay-wrapper", ref: (el) => (this.wrapperEl = el) }, h("div", { key: '92ec855379f10e1e0bfce6ff68b45d3cda0c137c', class: "action-sheet-container" }, h("div", { key: 'bc88a396d75396f574961471bf7e6c4edb513353', class: "action-sheet-group", ref: (el) => (this.groupEl = el), role: hasRadioButtons ? 'radiogroup' : undefined }, header !== undefined && (h("div", { key: '33329e0193818888bdcaa443ff5ea301802e0787', id: headerID, class: {
|
|
433
417
|
'action-sheet-title': true,
|
|
434
418
|
'action-sheet-has-sub-title': this.subHeader !== undefined,
|
|
435
|
-
} }, header, this.subHeader && h("div", { key: '
|
|
419
|
+
} }, header, this.subHeader && h("div", { key: '92ac5a9217a12b7417f7aca9c4fdb7bf6b051364', class: "action-sheet-sub-title" }, this.subHeader))), this.renderActionSheetButtons(buttons)), cancelButton && (h("div", { key: '020463b830fa48fc3ae647ea64f2aaa4d0969305', class: "action-sheet-group action-sheet-group-cancel" }, h("button", { key: 'cefa9c70a2233f6652a81b1a2eae6e717712144d', ...cancelButton.htmlAttributes, type: "button", class: buttonClass(cancelButton), onClick: () => this.buttonClick(cancelButton) }, h("span", { key: '56d7e2f8bfb3644e4476895164d334445fda9b2f', class: "action-sheet-button-inner" }, cancelButton.icon && (h("ion-icon", { key: '6a4a49254ec5cd96f4e0dce9447f90d8cac81913', icon: cancelButton.icon, "aria-hidden": "true", lazy: false, class: "action-sheet-icon" })), cancelButton.text), mode === 'md' && h("ion-ripple-effect", { key: '7d3c6e8d70b0922ea0f75520856285ce1005c891' })))))), h("div", { key: '958fc43e603c6a7f5d1e649d3326fce0f163b5d0', tabindex: "0", "aria-hidden": "true" })));
|
|
436
420
|
}
|
|
437
421
|
static get is() { return "ion-action-sheet"; }
|
|
438
422
|
static get encapsulation() { return "scoped"; }
|
|
@@ -8,7 +8,7 @@ import { raf } from "../../utils/helpers";
|
|
|
8
8
|
import { createLockController } from "../../utils/lock-controller";
|
|
9
9
|
import { printIonWarning } from "../../utils/logging/index";
|
|
10
10
|
import { getOverlayLabelJustify, getOverlayLabelPlacement } from "../../utils/overlay-control-label";
|
|
11
|
-
import { BACKDROP, cleanupRootFocusTrapAccessibility, createDelegateController, createTriggerController, dismiss, eventMethod, isCancel, prepareOverlay, present,
|
|
11
|
+
import { BACKDROP, cleanupRootFocusTrapAccessibility, createDelegateController, createTriggerController, dismiss, eventMethod, isCancel, prepareOverlay, present, safeCall, setOverlayId, } from "../../utils/overlays";
|
|
12
12
|
import { sanitizeDOMString } from "../../utils/sanitization/index";
|
|
13
13
|
import { renderOptionLabel } from "../../utils/select-option-render";
|
|
14
14
|
import { getClassMap } from "../../utils/theme";
|
|
@@ -198,15 +198,10 @@ export class Alert {
|
|
|
198
198
|
this.triggerChanged();
|
|
199
199
|
/**
|
|
200
200
|
* If the alert was previously connected and is being reattached, the
|
|
201
|
-
*
|
|
202
|
-
*
|
|
201
|
+
* ResizeObserver was disconnected. componentDidLoad only fires once per
|
|
202
|
+
* instance, so re-establish the observer here on reconnect.
|
|
203
203
|
*/
|
|
204
204
|
this.setupButtonGroupResizeObserver();
|
|
205
|
-
this.setupButtonActiveGesture();
|
|
206
|
-
// Re-apply the root lock if moved without dismiss() being called
|
|
207
|
-
if (this.presented) {
|
|
208
|
-
restoreRootFocusTrapAccessibility(this.el);
|
|
209
|
-
}
|
|
210
205
|
}
|
|
211
206
|
componentWillLoad() {
|
|
212
207
|
if (!this.htmlAttributes?.id) {
|
|
@@ -228,20 +223,17 @@ export class Alert {
|
|
|
228
223
|
this.buttonGroupResizeObserver?.disconnect();
|
|
229
224
|
this.buttonGroupResizeObserver = undefined;
|
|
230
225
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
226
|
+
componentDidLoad() {
|
|
227
|
+
/**
|
|
228
|
+
* Only create gesture if:
|
|
229
|
+
* 1. A gesture does not already exist
|
|
230
|
+
* 2. App is running in iOS mode
|
|
231
|
+
* 3. A wrapper ref exists
|
|
232
|
+
*/
|
|
238
233
|
if (!this.gesture && getIonMode(this) === 'ios' && this.wrapperEl) {
|
|
239
234
|
this.gesture = createButtonActiveGesture(this.wrapperEl, (refEl) => refEl.classList.contains('alert-button'));
|
|
240
235
|
this.gesture.enable(true);
|
|
241
236
|
}
|
|
242
|
-
}
|
|
243
|
-
componentDidLoad() {
|
|
244
|
-
this.setupButtonActiveGesture();
|
|
245
237
|
this.setupButtonGroupResizeObserver();
|
|
246
238
|
/**
|
|
247
239
|
* If alert was rendered with isOpen="true"
|
|
@@ -564,14 +556,14 @@ export class Alert {
|
|
|
564
556
|
* If neither are defined, do not set aria-labelledby.
|
|
565
557
|
*/
|
|
566
558
|
const ariaLabelledBy = header && subHeader ? `${hdrId} ${subHdrId}` : header ? hdrId : subHeader ? subHdrId : null;
|
|
567
|
-
return (h(Host, { key: '
|
|
559
|
+
return (h(Host, { key: '022f3463b8e6c52064b90ec304c524847c3d5ad3', tabindex: "-1", style: {
|
|
568
560
|
zIndex: `${20000 + overlayIndex}`,
|
|
569
561
|
}, class: {
|
|
570
562
|
...getClassMap(this.cssClass),
|
|
571
563
|
[mode]: true,
|
|
572
564
|
'overlay-hidden': true,
|
|
573
565
|
'alert-translucent': this.translucent,
|
|
574
|
-
}, onIonAlertWillDismiss: this.dispatchCancelHandler, onIonBackdropTap: this.onBackdropTap }, h("ion-backdrop", { key: '
|
|
566
|
+
}, onIonAlertWillDismiss: this.dispatchCancelHandler, onIonBackdropTap: this.onBackdropTap }, h("ion-backdrop", { key: 'c3cd05738bc2834f54707edeb2fae06ec10d6fd2', tappable: this.backdropDismiss }), h("div", { key: 'b44fadd9ba7ddf073854c5035538d11ae8e66bc2', tabindex: "0", "aria-hidden": "true" }), h("div", { key: 'fafea048141a6c7957e62aef31faa8041dd610c1', class: "alert-wrapper ion-overlay-wrapper", role: role, "aria-modal": "true", "aria-labelledby": ariaLabelledBy, "aria-describedby": message !== undefined ? msgId : null, tabindex: "0", ref: (el) => (this.wrapperEl = el), ...htmlAttributes }, h("div", { key: '3ad9d2d4b7cf425eab8293ddc12eff0fe8df1517', class: "alert-head" }, header && (h("h2", { key: '7d9154f5ee595b7e4da6ecf3a20871f104c1256e', id: hdrId, class: "alert-title" }, header)), subHeader && !header && (h("h2", { key: '1f891f38004be6964e9406b84dd580145c42516a', id: subHdrId, class: "alert-sub-title" }, subHeader)), subHeader && header && (h("h3", { key: '2ab4d344ecb7e384e8f6d3d3e59ee5a1bbcc832c', id: subHdrId, class: "alert-sub-title" }, subHeader))), this.renderAlertMessage(msgId), this.renderAlertInputs(), this.renderAlertButtons()), h("div", { key: '78a4ff09aa3aaafcd0dc2a42d036767d83b3cfa2', tabindex: "0", "aria-hidden": "true" })));
|
|
575
567
|
}
|
|
576
568
|
static get is() { return "ion-alert"; }
|
|
577
569
|
static get encapsulation() { return "scoped"; }
|
|
@@ -23,7 +23,6 @@ export class Content {
|
|
|
23
23
|
this.cTop = -1;
|
|
24
24
|
this.cBottom = -1;
|
|
25
25
|
this.isMainContent = true;
|
|
26
|
-
this.sizeToContent = false;
|
|
27
26
|
this.resizeTimeout = null;
|
|
28
27
|
this.inheritedAttributes = {};
|
|
29
28
|
this.tabsElement = null;
|
|
@@ -120,7 +119,6 @@ export class Content {
|
|
|
120
119
|
}
|
|
121
120
|
// Re-observe on reattach, since componentDidLoad only fires once.
|
|
122
121
|
this.setupFullscreenResizeObserver();
|
|
123
|
-
this.setupSizeToContentObserver();
|
|
124
122
|
}
|
|
125
123
|
componentDidLoad() {
|
|
126
124
|
// The custom elements build assigns fullscreen after connectedCallback.
|
|
@@ -147,7 +145,6 @@ export class Content {
|
|
|
147
145
|
this.resizeTimeout = null;
|
|
148
146
|
}
|
|
149
147
|
this.destroyFullscreenResizeObserver();
|
|
150
|
-
this.destroySizeToContentObserver();
|
|
151
148
|
}
|
|
152
149
|
/**
|
|
153
150
|
* Header and footer sizes can change after load without a window resize
|
|
@@ -178,45 +175,6 @@ export class Content {
|
|
|
178
175
|
});
|
|
179
176
|
this.fullscreenResizeObserver.observe(this.el);
|
|
180
177
|
}
|
|
181
|
-
/**
|
|
182
|
-
* A modal's `--height` can be changed at runtime with no event to react to,
|
|
183
|
-
* either by setting the property directly or by toggling a class that changes
|
|
184
|
-
* which rule wins. Both of those mutate an attribute on the modal, so watch
|
|
185
|
-
* for that and re-evaluate. Viewport driven changes are already covered by
|
|
186
|
-
* the `resize` listener.
|
|
187
|
-
*/
|
|
188
|
-
setupSizeToContentObserver() {
|
|
189
|
-
if (!Build.isBrowser || typeof MutationObserver === 'undefined') {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
if (this.sizeToContentObserver !== undefined) {
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
const modal = this.el.closest('ion-modal');
|
|
196
|
-
if (modal === null) {
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
this.sizeToContentObserver = new MutationObserver(() => this.updateSizeToContent());
|
|
200
|
-
this.sizeToContentObserver.observe(modal, { attributes: true, attributeFilter: ['style', 'class'] });
|
|
201
|
-
}
|
|
202
|
-
destroySizeToContentObserver() {
|
|
203
|
-
if (this.sizeToContentObserver !== undefined) {
|
|
204
|
-
this.sizeToContentObserver.disconnect();
|
|
205
|
-
this.sizeToContentObserver = undefined;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Re-renders when the overlay is no longer sized the way the last render
|
|
210
|
-
* assumed. Read in a `readTask` because resolving the custom property forces
|
|
211
|
-
* a style recalculation.
|
|
212
|
-
*/
|
|
213
|
-
updateSizeToContent() {
|
|
214
|
-
readTask(() => {
|
|
215
|
-
if (this.shouldSizeToContent() !== this.sizeToContent) {
|
|
216
|
-
forceUpdate(this);
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
178
|
destroyFullscreenResizeObserver() {
|
|
221
179
|
if (this.fullscreenResizeObserver !== undefined) {
|
|
222
180
|
this.fullscreenResizeObserver.disconnect();
|
|
@@ -263,30 +221,6 @@ export class Content {
|
|
|
263
221
|
const mode = getIonMode(this);
|
|
264
222
|
return forceOverscroll === undefined ? mode === 'ios' && isPlatform('ios') : forceOverscroll;
|
|
265
223
|
}
|
|
266
|
-
/**
|
|
267
|
-
* Whether this component should size itself to its contents height, which
|
|
268
|
-
* is the case inside any popover and inside a modal whose `--height` is a
|
|
269
|
-
* content-based value. Those overlays give the content no definite height
|
|
270
|
-
* to fill.
|
|
271
|
-
*/
|
|
272
|
-
shouldSizeToContent() {
|
|
273
|
-
if (hostContext('ion-popover', this.el)) {
|
|
274
|
-
return true;
|
|
275
|
-
}
|
|
276
|
-
const modal = this.el.closest('ion-modal');
|
|
277
|
-
if (modal === null) {
|
|
278
|
-
return false;
|
|
279
|
-
}
|
|
280
|
-
const height = getComputedStyle(modal).getPropertyValue('--height').trim();
|
|
281
|
-
/**
|
|
282
|
-
* Compared as a suffix so a value carrying only a vendor prefix is still
|
|
283
|
-
* recognized, such as the `-moz-fit-content` that Firefox needs before 94.
|
|
284
|
-
*
|
|
285
|
-
* TODO: replace with `CONTENT_SIZED_HEIGHTS.includes(height)` once the
|
|
286
|
-
* oldest supported Firefox is 94 or higher.
|
|
287
|
-
*/
|
|
288
|
-
return CONTENT_SIZED_HEIGHTS.some((value) => height.endsWith(value));
|
|
289
|
-
}
|
|
290
224
|
resize() {
|
|
291
225
|
/**
|
|
292
226
|
* Only force update if the component is rendered in a browser context.
|
|
@@ -297,12 +231,6 @@ export class Content {
|
|
|
297
231
|
* TODO: Remove if STENCIL-834 determines Stencil will account for this.
|
|
298
232
|
*/
|
|
299
233
|
if (Build.isBrowser) {
|
|
300
|
-
/**
|
|
301
|
-
* A window resize can cross a media query that changes the modal's
|
|
302
|
-
* `--height`. The content's own offsets are unchanged, so neither branch
|
|
303
|
-
* below re-renders and the class from the last render would go stale.
|
|
304
|
-
*/
|
|
305
|
-
this.updateSizeToContent();
|
|
306
234
|
if (this.fullscreen) {
|
|
307
235
|
readTask(() => this.readDimensions());
|
|
308
236
|
}
|
|
@@ -490,21 +418,21 @@ export class Content {
|
|
|
490
418
|
const forceOverscroll = this.shouldForceOverscroll();
|
|
491
419
|
const transitionShadow = mode === 'ios';
|
|
492
420
|
this.resize();
|
|
493
|
-
return (h(Host, { key: '
|
|
421
|
+
return (h(Host, { key: '9551c759df407b10d809171641fc6e8f14d92219', role: isMainContent ? 'main' : undefined, class: createColorClasses(this.color, {
|
|
494
422
|
[mode]: true,
|
|
495
423
|
'content-fullscreen': this.fullscreen,
|
|
496
|
-
'content-sizing': (
|
|
424
|
+
'content-sizing': hostContext('ion-popover', this.el),
|
|
497
425
|
overscroll: forceOverscroll,
|
|
498
426
|
[`content-${rtl}`]: true,
|
|
499
427
|
}), style: {
|
|
500
428
|
'--offset-top': `${this.cTop}px`,
|
|
501
429
|
'--offset-bottom': `${this.cBottom}px`,
|
|
502
|
-
}, ...inheritedAttributes }, h("div", { key: '
|
|
430
|
+
}, ...inheritedAttributes }, h("div", { key: 'c6de8fd226f0d10a534eb107fe032ac155fbe68e', ref: (el) => (this.backgroundContentEl = el), id: "background-content", part: "background" }), fixedSlotPlacement === 'before' ? h("slot", { name: "fixed" }) : null, h("div", { key: '082fc2936061360060b48221ecb1c864a3711fa0', class: {
|
|
503
431
|
'inner-scroll': true,
|
|
504
432
|
'scroll-x': scrollX,
|
|
505
433
|
'scroll-y': scrollY,
|
|
506
434
|
overscroll: (scrollX || scrollY) && forceOverscroll,
|
|
507
|
-
}, ref: (scrollEl) => (this.scrollEl = scrollEl), onScroll: this.scrollEvents ? (ev) => this.onScroll(ev) : undefined, part: "scroll" }, h("slot", { key: '
|
|
435
|
+
}, ref: (scrollEl) => (this.scrollEl = scrollEl), onScroll: this.scrollEvents ? (ev) => this.onScroll(ev) : undefined, part: "scroll" }, h("slot", { key: '0d2286206facb22696a9ca7e74a3f6b7d2397aab' })), transitionShadow ? (h("div", { class: "transition-effect" }, h("div", { class: "transition-cover" }), h("div", { class: "transition-shadow" }))) : null, fixedSlotPlacement === 'after' ? h("slot", { name: "fixed" }) : null));
|
|
508
436
|
}
|
|
509
437
|
static get is() { return "ion-content"; }
|
|
510
438
|
static get encapsulation() { return "shadow"; }
|
|
@@ -946,11 +874,6 @@ export class Content {
|
|
|
946
874
|
}];
|
|
947
875
|
}
|
|
948
876
|
}
|
|
949
|
-
/**
|
|
950
|
-
* `ion-modal` `--height` values that size the modal to its contents, leaving
|
|
951
|
-
* children an indefinite height to resolve against.
|
|
952
|
-
*/
|
|
953
|
-
const CONTENT_SIZED_HEIGHTS = ['auto', 'fit-content', 'min-content', 'max-content'];
|
|
954
877
|
const getParentElement = (el) => {
|
|
955
878
|
if (el.parentElement) {
|
|
956
879
|
// normal element with a parent element
|
|
@@ -5,7 +5,7 @@ import { Host, h } from "@stencil/core";
|
|
|
5
5
|
import { ENABLE_HTML_CONTENT_DEFAULT } from "../../utils/config";
|
|
6
6
|
import { raf } from "../../utils/helpers";
|
|
7
7
|
import { createLockController } from "../../utils/lock-controller";
|
|
8
|
-
import { BACKDROP, cleanupRootFocusTrapAccessibility, createDelegateController, createTriggerController, dismiss, eventMethod, prepareOverlay, present,
|
|
8
|
+
import { BACKDROP, cleanupRootFocusTrapAccessibility, createDelegateController, createTriggerController, dismiss, eventMethod, prepareOverlay, present, setOverlayId, } from "../../utils/overlays";
|
|
9
9
|
import { sanitizeDOMString } from "../../utils/sanitization/index";
|
|
10
10
|
import { getClassMap } from "../../utils/theme";
|
|
11
11
|
import { config } from "../../global/config";
|
|
@@ -82,10 +82,6 @@ export class Loading {
|
|
|
82
82
|
connectedCallback() {
|
|
83
83
|
prepareOverlay(this.el);
|
|
84
84
|
this.triggerChanged();
|
|
85
|
-
// Re-apply the root lock if moved without dismiss() being called
|
|
86
|
-
if (this.presented) {
|
|
87
|
-
restoreRootFocusTrapAccessibility(this.el);
|
|
88
|
-
}
|
|
89
85
|
}
|
|
90
86
|
componentWillLoad() {
|
|
91
87
|
if (this.spinner === undefined) {
|
|
@@ -186,14 +182,14 @@ export class Loading {
|
|
|
186
182
|
* Otherwise, don't set aria-labelledby.
|
|
187
183
|
*/
|
|
188
184
|
const ariaLabelledBy = message !== undefined ? msgId : null;
|
|
189
|
-
return (h(Host, { key: '
|
|
185
|
+
return (h(Host, { key: '2d14122ff3081de73631a7fdd4affdd5c73b8618', role: "dialog", "aria-modal": "true", "aria-labelledby": ariaLabelledBy, tabindex: "-1", ...htmlAttributes, style: {
|
|
190
186
|
zIndex: `${40000 + this.overlayIndex}`,
|
|
191
187
|
}, onIonBackdropTap: this.onBackdropTap, class: {
|
|
192
188
|
...getClassMap(this.cssClass),
|
|
193
189
|
[mode]: true,
|
|
194
190
|
'overlay-hidden': true,
|
|
195
191
|
'loading-translucent': this.translucent,
|
|
196
|
-
} }, h("ion-backdrop", { key: '
|
|
192
|
+
} }, h("ion-backdrop", { key: 'b7d5bb0d670a20c159d7f67327bf3b1489449188', visible: this.showBackdrop, tappable: this.backdropDismiss }), h("div", { key: '085ce92bd2004d323ab47eb472b83826e48dc619', tabindex: "0", "aria-hidden": "true" }), h("div", { key: '4ecd5bfc0bbd3da434d32f0f319f867a44c5e1f1', class: "loading-wrapper ion-overlay-wrapper" }, spinner && (h("div", { key: '5a4498e1421e09d01c0ee4312eae5272e95c3127', class: "loading-spinner" }, h("ion-spinner", { key: '1b3bc7d45d775195657ead3535f65e6b79f37e84', name: spinner, "aria-hidden": "true" }))), message !== undefined && this.renderLoadingMessage(msgId)), h("div", { key: 'bc7c5467b9f1c6ab957f79934e97acc713bdec37', tabindex: "0", "aria-hidden": "true" })));
|
|
197
193
|
}
|
|
198
194
|
static get is() { return "ion-loading"; }
|
|
199
195
|
static get encapsulation() { return "scoped"; }
|
|
@@ -77,12 +77,7 @@
|
|
|
77
77
|
--max-width: auto;
|
|
78
78
|
--height: 100%;
|
|
79
79
|
--min-height: auto;
|
|
80
|
-
|
|
81
|
-
* Clamps a content-sized `--height` (auto, fit-content, ...) to the
|
|
82
|
-
* overlay, giving the wrapper's flex children something to shrink
|
|
83
|
-
* toward so `ion-content` scrolls instead of overflowing.
|
|
84
|
-
*/
|
|
85
|
-
--max-height: 100%;
|
|
80
|
+
--max-height: auto;
|
|
86
81
|
--overflow: hidden;
|
|
87
82
|
--border-radius: 0;
|
|
88
83
|
--border-width: 0;
|
|
@@ -134,14 +129,8 @@ ion-backdrop {
|
|
|
134
129
|
/**
|
|
135
130
|
* The wrapper receives programmatic focus for screen readers but should not
|
|
136
131
|
* show a visible focus ring, which is meant only for keyboard navigation.
|
|
137
|
-
*
|
|
138
|
-
* A flex layout is required for the wrapper to size itself to its content
|
|
139
|
-
* when the modal is content-sized (`--height` is auto, fit-content, ...).
|
|
140
|
-
* This makes it so that the content can scroll when it overflows the wrapper.
|
|
141
132
|
*/
|
|
142
133
|
.modal-wrapper {
|
|
143
|
-
display: flex;
|
|
144
|
-
flex-direction: column;
|
|
145
134
|
outline: none;
|
|
146
135
|
}
|
|
147
136
|
|