diff --git a/core/src/components/modal/modal.tsx b/core/src/components/modal/modal.tsx index 12056b5204..c718441a43 100644 --- a/core/src/components/modal/modal.tsx +++ b/core/src/components/modal/modal.tsx @@ -18,7 +18,8 @@ import type { } from '../../interface'; import { findIonContent, printIonContentErrorMsg } from '../../utils/content'; import { CoreDelegate, attachComponent, detachComponent } from '../../utils/framework-delegate'; -import { raf } from '../../utils/helpers'; +import { raf, inheritAttributes } from '../../utils/helpers'; +import type { Attributes } from '../../utils/helpers'; import { KEYBOARD_DID_OPEN } from '../../utils/keyboard/keyboard'; import { printIonWarning } from '../../utils/logging'; import { BACKDROP, activeAnimations, dismiss, eventMethod, prepareOverlay, present } from '../../utils/overlays'; @@ -66,6 +67,7 @@ export class Modal implements ComponentInterface, OverlayInterface { private sortedBreakpoints?: number[]; private keyboardOpenCallback?: () => void; private moveSheetToBreakpoint?: (options: MoveSheetToBreakpointOptions) => Promise; + private inheritedAttributes: Attributes = {}; private inline = false; private workingDelegate?: FrameworkDelegate; @@ -334,7 +336,9 @@ export class Modal implements ComponentInterface, OverlayInterface { } componentWillLoad() { - const { breakpoints, initialBreakpoint, swipeToClose } = this; + const { breakpoints, initialBreakpoint, swipeToClose, el } = this; + + this.inheritedAttributes = inheritAttributes(el, ['role']); /** * If user has custom ID set then we should @@ -855,7 +859,7 @@ export class Modal implements ComponentInterface, OverlayInterface { }; render() { - const { handle, isSheetModal, presentingElement, htmlAttributes, handleBehavior } = this; + const { handle, isSheetModal, presentingElement, htmlAttributes, handleBehavior, inheritedAttributes } = this; const showHandle = handle !== false && isSheetModal; const mode = getIonMode(this); @@ -867,8 +871,10 @@ export class Modal implements ComponentInterface, OverlayInterface { } -