Native overlay
Inline Polaris modal with reliable close, focus and scroll restoration.
Interactive example
Loading Polaris web components…
Usage
<NativeOverlay heading="Confirm changes" onClose={close}><s-paragraph>Review the change before saving.</s-paragraph><s-button slot="secondary-actions" onClick={closeNative}>Cancel</s-button></NativeOverlay>Properties
| Property | Type | Default | Description |
|---|---|---|---|
| heading | string | Required | Accessible native dialog title. |
| children | ReactNode | Required | Native content and native action slots. |
| onClose | ()=>void | Required | Unmount after the native afterhide lifecycle. |
| size | base | small | large | base | Native modal size. |
| modalRef | RefObject<HTMLElement|null> | — | Optional host reference; call public hideOverlay to close. |
Design & interaction
An inline app modal, not an App Bridge separate-frame modal. No business calls or credentials. Prefer public show/hide; isolate the verified App Bridge delegation compatibility and a bounded private dismissal fallback. Do not close the shadow dialog directly. Previous versions remain immutable.
Accessibility
Native focus trap, Escape/header dismissal and focus return. onClose runs once after afterhide. Consumer must test absence of inert/scroll/overlay residue and keyboard reopening in its actual Shopify host.
Open-source source
Available in github.com/Kaupvik/kaupvik-polaris ↗. Host apps supply authentication, native persistence, and read-back state.