Functional page JavaScript
6.120 KB 2.596 KB gzipAlways loaded.
Browser experiments & working notes
03 / Dialog commands
Send dialog commands through a component’s public ID.
commandfor="host"#dialogPreparing the controls…
Automatic checks for the native property. Force fallback loads the selected adapters. Browser alone leaves them out.
Dialog commands
Send dialog commands into a closed shadow root.
Try: Open the modal. Use the non-modal preview for outside Close/Request close.
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.
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');
});
Always loaded.
Core + selected adapters.
Always-loaded and fallback files; shared files counted once.
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.
Generated markup, including these measurements.
Styles, icon, and the highlighting scheduler; functional JS is separate above.
Document + functional fallback path + initial supporting assets, with unique files counted once.
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.
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.
| File | Delivery | Minified | Gzip |
|---|---|---|---|
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 |
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.