Functional page JavaScript
5.097 KB 2.235 KB gzipAlways loaded.
Browser experiments & working notes
05 / Text names
Use component-provided text for names and descriptions.
aria-labelledby="host"#labelPreparing the controls…
Automatic checks for the native property. Force fallback loads the selected adapters. Browser alone leaves them out.
Text names and descriptions
Let components supply an input’s name and description.
This extra component text is outside the selected name.
Tell us where the parcel should be left.
This extra component text is outside the selected description.
Try: Change the text, then inspect the input’s name and description in your accessibility tools.
The fallback creates hidden text references from data-label-text and data-description-text. Components keep those public values in sync with their visible text.
This plain-text approximation does not compute accessible names from arbitrary markup. The readout shows DOM references, not computed accessibility.
Publish text on the hosts; select a provider during fallback setup.
<input id="tn-input" type="text" aria-labelledby="tn-label-host"
aria-describedby="tn-description-host">
<rt-gallery-label id="tn-label-host" data-reference-target="text"
data-label-text="Delivery preference">
<template shadowrootmode="open" shadowrootreferencetarget="text">
<strong id="text">Delivery preference</strong>
<p>This extra component text is outside the selected name.</p>
</template>
</rt-gallery-label>
<rt-gallery-description id="tn-description-host" data-reference-target="text"
data-description-text="Tell us where the parcel should be left.">
<template shadowrootmode="open" shadowrootreferencetarget="text">
<p id="text">Tell us where the parcel should be left.</p>
</template>
</rt-gallery-description>
// In the conditionally loaded setup module (package imports):
import { installReferenceTarget } from 'reference-target-fallback/core';
import { textNames } from 'reference-target-fallback/adapters/text-names';
const fallback = installReferenceTarget({
adapters: [textNames({
getText(host, kind) {
return host.getAttribute(kind === 'label'
? 'data-label-text' : 'data-description-text');
},
})],
});
fallback.hydrate(document);
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: text-names.
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 |
|---|---|---|---|
shared/chunks/app-M4PZ3W3X.js |
Page | 1.698 KB | 0.745 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-I7SMHH5F.js |
Fallback additional | 21.009 KB | 7.391 KB |
text-names/main.js |
Page | 3.257 KB | 1.352 KB |
Names and descriptions come from explicit public text. The adapter does not compute accessible names from arbitrary shadow content.
Readouts describe DOM state. Check computed names, keyboard behavior and assistive technology separately.