Dialog commands

Reach a closed shadow root

Send dialog commands into a closed shadow root.

Try: Open the modal. Use the non-modal preview for outside Close/Request close.

Component-reported DOM stateWaiting for setup.
Behavior & limits

A modal makes outside controls inert; close it from inside before trying the non-modal preview. Arm cancellation before Request close to keep the dialog open. Close bypasses the cancel event.

The adapter uses native dialog methods. The component reports its state; its public shadowRoot remains null.

Code sample

Outside command, private dialog, internal close handler.

<button id="dc-show" type="button" commandfor="dc-host"
    command="show-modal">Show modal</button>
<rt-closed-dialog-demo id="dc-host"></rt-closed-dialog-demo>
// Run component code after any fallback setup has finished.
const host = document.getElementById('dc-host');
const root = host.attachShadow({
  mode: 'closed', referenceTarget: 'dc-dialog',
});
root.innerHTML = `
  <dialog id="dc-dialog" aria-labelledby="dc-dialog-title">
    <h2 id="dc-dialog-title">A moment of focus</h2>
    <button id="dc-internal-close" type="button">Close dialog</button>
  </dialog>
`;
const dialog = root.getElementById('dc-dialog');
root.getElementById('dc-internal-close').addEventListener('click', () => {
  dialog.close('closed-inside');
});

Functional JavaScript sizes

Functional page JavaScript

6.120 KB 2.596 KB gzip

Always loaded.

Fallback additional

19.270 KB 7.006 KB gzip

Core + selected adapters.

Fallback route total

25.390 KB 9.602 KB gzip

Always-loaded and fallback files; shared files counted once.

Native-surface route total

7.109 KB 3.134 KB gzip

Includes 0.989 KB (0.538 KB gzip) of behavioral probes requested only after the property surface is present.

Minified / gzip. 1 KB = 1,000 bytes. Demo-only syntax highlighting is excluded from the functional totals and reported separately below.

Whole-page delivery context

HTML document

14.771 KB 1 request

Generated markup, including these measurements.

Initial supporting assets

18.520 KB raw 17.897 KB local transfer · 3 requests

Styles, icon, and the highlighting scheduler; functional JS is separate above.

Initial page with fallback

58.681 KB raw 42.270 KB local transfer · 9 requests

Document + functional fallback path + initial supporting assets, with unique files counted once.

Deferred highlighting

16.700 KB raw 7.831 KB local transfer · 8 requests

Engine, theme, and this page’s grammar closure, requested after a source disclosure opens or during idle time.

“Local transfer” matches the included development server: gzip JavaScript sidecars, but uncompressed HTML, CSS, and SVG. GitHub Pages, browser caching, HTTP headers, and production compression can change transferred bytes and request scheduling. Module preloads fetch functional modules early without evaluating the app and do not add duplicate transfers.

Inspect the 6 generated JavaScript files

Selected adapters: dialog-commands.

Gzip totals sum each compressed file. The fallback and native-probe routes are mutually exclusive. Separate CSS files, HTML, JSON, source maps, HTTP headers, and Microlighter assets are excluded. Component styles embedded in JavaScript are included. Transfer sizes depend on compression and caching. Microlighter MIT license.

Files included in this page’s totals
FileDeliveryMinifiedGzip
dialog-commands/main.js Page 3.257 KB 1.351 KB
shared/chunks/app-VKU5LUFH.js Page 2.721 KB 1.107 KB
shared/chunks/chunk-CLCOZ6O7.js Fallback / native probe shared 0.849 KB 0.422 KB
shared/chunks/chunk-S2QLMWTP.js Page 0.142 KB 0.138 KB
shared/chunks/detect-X6QVIAY4.js Native-surface probe 0.140 KB 0.116 KB
shared/chunks/reference-target.setup-ZXUPH6VO.js Fallback additional 18.421 KB 6.584 KB

Inspect the size manifest

Implementation notes & limitations

Fallback scope

Commands call native dialog methods; the adapter does not supply the Dialog API.

Readouts describe DOM state. Check computed names, keyboard behavior and assistive technology separately.