Functional page JavaScript
5.185 KB 2.286 KB gzipAlways loaded.
Browser experiments & working notes
04 / Popover commands
Show, hide or toggle a popover inside a component.
commandfor="host"#panelPreparing the controls…
Automatic checks for the native property. Force fallback loads the selected adapters. Browser alone leaves them out.
Popover commands
Send built-in popover commands to an internal panel.
A command reached the component
The component can cancel a command event before the corresponding native popover operation runs.
This manual popover stays open until a hide or toggle action closes it.
Try: Select “Cancel the next command,” then Show twice.
The first Show is canceled; the second opens the panel. Hide and Toggle exercise the other built-in commands.
The fallback uses native popover methods after dispatching a synthetic cancelable command event. Event trust, paths and source handling can differ from native behavior.
Three commands share one target. The demo also listens for cancellation.
<button id="pc-toggle" type="button" commandfor="pc-host"
command="toggle-popover">Toggle with a command</button>
<button id="pc-show" type="button" commandfor="pc-host"
command="show-popover">Show with a command</button>
<button id="pc-hide" type="button" commandfor="pc-host"
command="hide-popover">Hide with a command</button>
<rt-popover-command-demo id="pc-host" data-reference-target="pc-panel">
<template shadowrootmode="open" shadowrootreferencetarget="pc-panel">
<section id="pc-panel" popover="manual" role="dialog"
aria-labelledby="pc-panel-title">
<h2 id="pc-panel-title">A panel with a say</h2>
<button type="button" autofocus>Close from inside</button>
</section>
</template>
</rt-popover-command-demo>
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: popover-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 |
|---|---|---|---|
popover-commands/main.js |
Page | 3.257 KB | 1.351 KB |
shared/chunks/app-NKBZQNH6.js |
Page | 1.786 KB | 0.797 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-LPCOCIRI.js |
Fallback additional | 18.359 KB | 6.545 KB |
Requires the browser’s Popover API. Custom commands and complete native event semantics are outside this adapter’s scope.
Readouts describe DOM state. Check computed names, keyboard behavior and assistive technology separately.