a11y-elements 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1139 -10
- package/dist/a11y.css +146 -12
- package/dist/browser/{accessibility-components → components}/anchor/define.js +136 -12
- package/dist/browser/components/anchor/define.js.map +1 -0
- package/dist/browser/{accessibility-components → components}/avatar/define.js +103 -10
- package/dist/browser/components/avatar/define.js.map +1 -0
- package/dist/browser/{accessibility-components → components}/checkbox/define.js +92 -7
- package/dist/browser/components/checkbox/define.js.map +1 -0
- package/dist/browser/components/focusable/define.js +199 -0
- package/dist/browser/components/focusable/define.js.map +1 -0
- package/dist/browser/components/input/define.js +669 -0
- package/dist/browser/components/input/define.js.map +1 -0
- package/dist/browser/components/label/define.js +262 -0
- package/dist/browser/components/label/define.js.map +1 -0
- package/dist/browser/{accessibility-components → components}/picture/define.js +92 -5
- package/dist/browser/components/picture/define.js.map +1 -0
- package/dist/browser/components/progress/define.js +227 -0
- package/dist/browser/components/progress/define.js.map +1 -0
- package/dist/browser/{accessibility-components → components}/radio-group/define.js +92 -6
- package/dist/browser/components/radio-group/define.js.map +1 -0
- package/dist/browser/{accessibility-components → components}/select/define.js +92 -6
- package/dist/browser/components/select/define.js.map +1 -0
- package/dist/browser/{accessibility-components → components}/skeleton/define.js +93 -7
- package/dist/browser/components/skeleton/define.js.map +1 -0
- package/dist/browser/{accessibility-components → components}/spinner/define.js +100 -8
- package/dist/browser/components/spinner/define.js.map +1 -0
- package/dist/browser/{accessibility-components → components}/switch/define.js +92 -6
- package/dist/browser/components/switch/define.js.map +1 -0
- package/dist/browser/components/textarea/define.js +669 -0
- package/dist/browser/components/textarea/define.js.map +1 -0
- package/dist/browser/components/visually-hidden/define.js +183 -0
- package/dist/browser/components/visually-hidden/define.js.map +1 -0
- package/dist/browser/overlays/blocking-loader/define.js +170 -13
- package/dist/browser/overlays/blocking-loader/define.js.map +1 -1
- package/dist/browser/overlays/context-menu/define.js +283 -121
- package/dist/browser/overlays/context-menu/define.js.map +1 -1
- package/dist/browser/overlays/drawer/define.js +190 -13
- package/dist/browser/overlays/drawer/define.js.map +1 -1
- package/dist/browser/overlays/dropdown/define.js +283 -121
- package/dist/browser/overlays/dropdown/define.js.map +1 -1
- package/dist/browser/overlays/emergency-dialog/define.js +190 -13
- package/dist/browser/overlays/emergency-dialog/define.js.map +1 -1
- package/dist/browser/overlays/modal/define.js +190 -14
- package/dist/browser/overlays/modal/define.js.map +1 -1
- package/dist/browser/overlays/notification-banner/define.js +171 -15
- package/dist/browser/overlays/notification-banner/define.js.map +1 -1
- package/dist/browser/overlays/popover/define.js +172 -11
- package/dist/browser/overlays/popover/define.js.map +1 -1
- package/dist/browser/overlays/snackbar/define.js +148 -15
- package/dist/browser/overlays/snackbar/define.js.map +1 -1
- package/dist/browser/overlays/tooltip/define.js +189 -14
- package/dist/browser/overlays/tooltip/define.js.map +1 -1
- package/dist/{accessibility-components → components}/anchor/anchor.element.d.ts +12 -4
- package/dist/{accessibility-components → components}/anchor/anchor.element.js +56 -11
- package/dist/components/anchor/anchor.element.js.map +1 -0
- package/dist/{accessibility-components → components}/anchor/define.d.ts +1 -0
- package/dist/{accessibility-components → components}/anchor/define.js +2 -0
- package/dist/components/anchor/define.js.map +1 -0
- package/dist/{accessibility-components → components}/avatar/avatar.element.d.ts +2 -0
- package/dist/{accessibility-components → components}/avatar/avatar.element.js +10 -3
- package/dist/components/avatar/avatar.element.js.map +1 -0
- package/dist/{accessibility-components → components}/avatar/define.d.ts +1 -0
- package/dist/{accessibility-components → components}/avatar/define.js +2 -0
- package/dist/components/avatar/define.js.map +1 -0
- package/dist/{accessibility-components → components}/checkbox/checkbox.element.js +0 -2
- package/dist/components/checkbox/checkbox.element.js.map +1 -0
- package/dist/{accessibility-components → components}/checkbox/define.d.ts +1 -0
- package/dist/{accessibility-components → components}/checkbox/define.js +2 -0
- package/dist/components/checkbox/define.js.map +1 -0
- package/dist/{accessibility-components → components}/focusable/define.d.ts +1 -0
- package/dist/{accessibility-components → components}/focusable/define.js +2 -0
- package/dist/components/focusable/define.js.map +1 -0
- package/dist/components/focusable/focusable.element.js.map +1 -0
- package/dist/components/input/define.d.ts +9 -0
- package/dist/components/input/define.js +9 -0
- package/dist/components/input/define.js.map +1 -0
- package/dist/components/input/input.element.d.ts +22 -0
- package/dist/components/input/input.element.js +23 -0
- package/dist/components/input/input.element.js.map +1 -0
- package/dist/components/label/define.d.ts +8 -0
- package/dist/components/label/define.js +8 -0
- package/dist/components/label/define.js.map +1 -0
- package/dist/components/label/label.element.d.ts +32 -0
- package/dist/components/label/label.element.js +62 -0
- package/dist/components/label/label.element.js.map +1 -0
- package/dist/{accessibility-components → components}/picture/define.d.ts +1 -0
- package/dist/{accessibility-components → components}/picture/define.js +2 -0
- package/dist/components/picture/define.js.map +1 -0
- package/dist/components/picture/picture.element.js.map +1 -0
- package/dist/{accessibility-components → components}/progress/define.d.ts +1 -0
- package/dist/{accessibility-components → components}/progress/define.js +2 -0
- package/dist/components/progress/define.js.map +1 -0
- package/dist/{accessibility-components → components}/progress/progress.element.d.ts +1 -0
- package/dist/{accessibility-components → components}/progress/progress.element.js +5 -1
- package/dist/components/progress/progress.element.js.map +1 -0
- package/dist/{accessibility-components → components}/radio-group/define.d.ts +1 -0
- package/dist/{accessibility-components → components}/radio-group/define.js +2 -0
- package/dist/components/radio-group/define.js.map +1 -0
- package/dist/{accessibility-components → components}/radio-group/radio-group.element.js +0 -1
- package/dist/components/radio-group/radio-group.element.js.map +1 -0
- package/dist/{accessibility-components → components}/select/define.d.ts +1 -0
- package/dist/{accessibility-components → components}/select/define.js +2 -0
- package/dist/components/select/define.js.map +1 -0
- package/dist/{accessibility-components → components}/select/select.element.js +0 -1
- package/dist/components/select/select.element.js.map +1 -0
- package/dist/{accessibility-components → components}/skeleton/define.d.ts +1 -0
- package/dist/{accessibility-components → components}/skeleton/define.js +2 -0
- package/dist/components/skeleton/define.js.map +1 -0
- package/dist/components/skeleton/skeleton.element.js.map +1 -0
- package/dist/{accessibility-components → components}/spinner/define.d.ts +1 -0
- package/dist/{accessibility-components → components}/spinner/define.js +2 -0
- package/dist/components/spinner/define.js.map +1 -0
- package/dist/{accessibility-components → components}/spinner/spinner.element.d.ts +1 -0
- package/dist/{accessibility-components → components}/spinner/spinner.element.js +5 -1
- package/dist/components/spinner/spinner.element.js.map +1 -0
- package/dist/{accessibility-components → components}/switch/define.d.ts +1 -0
- package/dist/{accessibility-components → components}/switch/define.js +2 -0
- package/dist/components/switch/define.js.map +1 -0
- package/dist/{accessibility-components → components}/switch/switch.element.js +0 -1
- package/dist/components/switch/switch.element.js.map +1 -0
- package/dist/components/textarea/define.d.ts +9 -0
- package/dist/components/textarea/define.js +9 -0
- package/dist/components/textarea/define.js.map +1 -0
- package/dist/components/textarea/textarea.element.d.ts +18 -0
- package/dist/components/textarea/textarea.element.js +19 -0
- package/dist/components/textarea/textarea.element.js.map +1 -0
- package/dist/{accessibility-components → components}/visually-hidden/define.d.ts +1 -0
- package/dist/{accessibility-components → components}/visually-hidden/define.js +2 -0
- package/dist/components/visually-hidden/define.js.map +1 -0
- package/dist/components/visually-hidden/visually-hidden.element.js.map +1 -0
- package/dist/core/a11y-element.d.ts +29 -1
- package/dist/core/a11y-element.js +65 -2
- package/dist/core/a11y-element.js.map +1 -1
- package/dist/core/a11y-field-element.d.ts +76 -0
- package/dist/core/a11y-field-element.js +220 -0
- package/dist/core/a11y-field-element.js.map +1 -0
- package/dist/core/a11y-overlay-element.d.ts +3 -1
- package/dist/core/a11y-overlay-element.js +12 -4
- package/dist/core/a11y-overlay-element.js.map +1 -1
- package/dist/core/a11y-wrapper-element.js +1 -0
- package/dist/core/a11y-wrapper-element.js.map +1 -1
- package/dist/core/dom-sync.d.ts +6 -0
- package/dist/core/dom-sync.js +13 -0
- package/dist/core/dom-sync.js.map +1 -1
- package/dist/core/field.d.ts +80 -0
- package/dist/core/field.js +256 -0
- package/dist/core/field.js.map +1 -0
- package/dist/core/focus-trap.d.ts +14 -0
- package/dist/core/focus-trap.js +85 -4
- package/dist/core/focus-trap.js.map +1 -1
- package/dist/core/ids.d.ts +2 -0
- package/dist/core/ids.js +18 -0
- package/dist/core/ids.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.js +4 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/overlay-registry.d.ts +12 -0
- package/dist/core/overlay-registry.js +29 -1
- package/dist/core/overlay-registry.js.map +1 -1
- package/dist/core/strings.d.ts +39 -0
- package/dist/core/strings.js +47 -0
- package/dist/core/strings.js.map +1 -0
- package/dist/overlays/blocking-loader/blocking-loader.element.d.ts +1 -0
- package/dist/overlays/blocking-loader/blocking-loader.element.js +8 -2
- package/dist/overlays/blocking-loader/blocking-loader.element.js.map +1 -1
- package/dist/overlays/blocking-loader/define.d.ts +3 -2
- package/dist/overlays/blocking-loader/define.js +4 -3
- package/dist/overlays/blocking-loader/define.js.map +1 -1
- package/dist/overlays/context-menu/define.d.ts +2 -1
- package/dist/overlays/context-menu/define.js +3 -2
- package/dist/overlays/context-menu/define.js.map +1 -1
- package/dist/overlays/core/a11y-menu-overlay-element.js +2 -1
- package/dist/overlays/core/a11y-menu-overlay-element.js.map +1 -1
- package/dist/overlays/core/a11y-modal-overlay-element.d.ts +7 -0
- package/dist/overlays/core/a11y-modal-overlay-element.js +19 -2
- package/dist/overlays/core/a11y-modal-overlay-element.js.map +1 -1
- package/dist/overlays/core/a11y-passive-overlay-element.d.ts +11 -3
- package/dist/overlays/core/a11y-passive-overlay-element.js +40 -13
- package/dist/overlays/core/a11y-passive-overlay-element.js.map +1 -1
- package/dist/overlays/drawer/define.d.ts +2 -1
- package/dist/overlays/drawer/define.js +3 -2
- package/dist/overlays/drawer/define.js.map +1 -1
- package/dist/overlays/drawer/drawer.element.js +0 -1
- package/dist/overlays/drawer/drawer.element.js.map +1 -1
- package/dist/overlays/dropdown/define.d.ts +2 -1
- package/dist/overlays/dropdown/define.js +3 -2
- package/dist/overlays/dropdown/define.js.map +1 -1
- package/dist/overlays/emergency-dialog/define.d.ts +2 -1
- package/dist/overlays/emergency-dialog/define.js +3 -2
- package/dist/overlays/emergency-dialog/define.js.map +1 -1
- package/dist/overlays/emergency-dialog/emergency-dialog.element.js +0 -1
- package/dist/overlays/emergency-dialog/emergency-dialog.element.js.map +1 -1
- package/dist/overlays/modal/define.d.ts +2 -1
- package/dist/overlays/modal/define.js +3 -2
- package/dist/overlays/modal/define.js.map +1 -1
- package/dist/overlays/modal/modal.element.js +0 -2
- package/dist/overlays/modal/modal.element.js.map +1 -1
- package/dist/overlays/notification-banner/define.d.ts +2 -0
- package/dist/overlays/notification-banner/define.js +3 -0
- package/dist/overlays/notification-banner/define.js.map +1 -1
- package/dist/overlays/notification-banner/notification-banner.element.d.ts +11 -0
- package/dist/overlays/notification-banner/notification-banner.element.js +27 -1
- package/dist/overlays/notification-banner/notification-banner.element.js.map +1 -1
- package/dist/overlays/popover/define.d.ts +2 -1
- package/dist/overlays/popover/define.js +3 -2
- package/dist/overlays/popover/define.js.map +1 -1
- package/dist/overlays/popover/popover.element.js +0 -1
- package/dist/overlays/popover/popover.element.js.map +1 -1
- package/dist/overlays/snackbar/define.d.ts +2 -0
- package/dist/overlays/snackbar/define.js +3 -0
- package/dist/overlays/snackbar/define.js.map +1 -1
- package/dist/overlays/snackbar/snackbar.element.d.ts +1 -1
- package/dist/overlays/tooltip/define.d.ts +2 -1
- package/dist/overlays/tooltip/define.js +3 -2
- package/dist/overlays/tooltip/define.js.map +1 -1
- package/dist/overlays/tooltip/tooltip.element.js +2 -7
- package/dist/overlays/tooltip/tooltip.element.js.map +1 -1
- package/package.json +9 -9
- package/dist/accessibility-components/anchor/anchor.element.js.map +0 -1
- package/dist/accessibility-components/anchor/define.js.map +0 -1
- package/dist/accessibility-components/avatar/avatar.element.js.map +0 -1
- package/dist/accessibility-components/avatar/define.js.map +0 -1
- package/dist/accessibility-components/checkbox/checkbox.element.js.map +0 -1
- package/dist/accessibility-components/checkbox/define.js.map +0 -1
- package/dist/accessibility-components/focusable/define.js.map +0 -1
- package/dist/accessibility-components/focusable/focusable.element.js.map +0 -1
- package/dist/accessibility-components/picture/define.js.map +0 -1
- package/dist/accessibility-components/picture/picture.element.js.map +0 -1
- package/dist/accessibility-components/progress/define.js.map +0 -1
- package/dist/accessibility-components/progress/progress.element.js.map +0 -1
- package/dist/accessibility-components/radio-group/define.js.map +0 -1
- package/dist/accessibility-components/radio-group/radio-group.element.js.map +0 -1
- package/dist/accessibility-components/select/define.js.map +0 -1
- package/dist/accessibility-components/select/select.element.js.map +0 -1
- package/dist/accessibility-components/skeleton/define.js.map +0 -1
- package/dist/accessibility-components/skeleton/skeleton.element.js.map +0 -1
- package/dist/accessibility-components/spinner/define.js.map +0 -1
- package/dist/accessibility-components/spinner/spinner.element.js.map +0 -1
- package/dist/accessibility-components/switch/define.js.map +0 -1
- package/dist/accessibility-components/switch/switch.element.js.map +0 -1
- package/dist/accessibility-components/visually-hidden/define.js.map +0 -1
- package/dist/accessibility-components/visually-hidden/visually-hidden.element.js.map +0 -1
- package/dist/browser/accessibility-components/anchor/define.js.map +0 -1
- package/dist/browser/accessibility-components/avatar/define.js.map +0 -1
- package/dist/browser/accessibility-components/checkbox/define.js.map +0 -1
- package/dist/browser/accessibility-components/focusable/define.js +0 -113
- package/dist/browser/accessibility-components/focusable/define.js.map +0 -1
- package/dist/browser/accessibility-components/picture/define.js.map +0 -1
- package/dist/browser/accessibility-components/progress/define.js +0 -135
- package/dist/browser/accessibility-components/progress/define.js.map +0 -1
- package/dist/browser/accessibility-components/radio-group/define.js.map +0 -1
- package/dist/browser/accessibility-components/select/define.js.map +0 -1
- package/dist/browser/accessibility-components/skeleton/define.js.map +0 -1
- package/dist/browser/accessibility-components/spinner/define.js.map +0 -1
- package/dist/browser/accessibility-components/switch/define.js.map +0 -1
- package/dist/browser/accessibility-components/visually-hidden/define.js +0 -97
- package/dist/browser/accessibility-components/visually-hidden/define.js.map +0 -1
- /package/dist/{accessibility-components → components}/checkbox/checkbox.element.d.ts +0 -0
- /package/dist/{accessibility-components → components}/focusable/focusable.element.d.ts +0 -0
- /package/dist/{accessibility-components → components}/focusable/focusable.element.js +0 -0
- /package/dist/{accessibility-components → components}/picture/picture.element.d.ts +0 -0
- /package/dist/{accessibility-components → components}/picture/picture.element.js +0 -0
- /package/dist/{accessibility-components → components}/radio-group/radio-group.element.d.ts +0 -0
- /package/dist/{accessibility-components → components}/select/select.element.d.ts +0 -0
- /package/dist/{accessibility-components → components}/skeleton/skeleton.element.d.ts +0 -0
- /package/dist/{accessibility-components → components}/skeleton/skeleton.element.js +0 -0
- /package/dist/{accessibility-components → components}/switch/switch.element.d.ts +0 -0
- /package/dist/{accessibility-components → components}/visually-hidden/visually-hidden.element.d.ts +0 -0
- /package/dist/{accessibility-components → components}/visually-hidden/visually-hidden.element.js +0 -0
|
@@ -10,10 +10,16 @@ import { A11yWrapperElement } from '../../core/a11y-wrapper-element.js';
|
|
|
10
10
|
* - **Internal same-page anchors** (`href="#id"`): native browser jump-links
|
|
11
11
|
* are jarring for keyboard/AT users — no scroll animation, and focus isn't
|
|
12
12
|
* moved to the target, so subsequent Tab presses continue from wherever
|
|
13
|
-
* focus happened to be. This smooth-scrolls to the target
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* focus happened to be. This smooth-scrolls to the target (instantly under
|
|
14
|
+
* `prefers-reduced-motion: reduce`), moves focus to it (temporarily made
|
|
15
|
+
* focusable via `tabindex="-1"`, its own `tabindex` restored on blur), and
|
|
16
|
+
* announces the navigation — by the target's label or heading — through a
|
|
17
|
+
* live region for screen-reader users. Space also activates (native anchors
|
|
18
|
+
* only activate on Enter).
|
|
19
|
+
*
|
|
20
|
+
* Both built-in strings can be translated: `new-tab-label="…"` /
|
|
21
|
+
* `navigated-label="… {name}"` on this element, else `setStrings({
|
|
22
|
+
* opensInNewTab, navigatedTo })`.
|
|
17
23
|
*
|
|
18
24
|
* ```html
|
|
19
25
|
* <a11y-anchor><a href="#section-2">Jump to section 2</a></a11y-anchor>
|
|
@@ -21,8 +27,10 @@ import { A11yWrapperElement } from '../../core/a11y-wrapper-element.js';
|
|
|
21
27
|
* ```
|
|
22
28
|
*/
|
|
23
29
|
export declare class AnchorElement extends A11yWrapperElement {
|
|
30
|
+
static get observedAttributes(): string[];
|
|
24
31
|
/** Each link's own `aria-label` before this element touched it, so the new-tab suffix is never applied twice and can be undone. */
|
|
25
32
|
private _originalLabels;
|
|
26
33
|
protected _sync(): void;
|
|
34
|
+
protected onStringsChange(): void;
|
|
27
35
|
private _activateInternalAnchor;
|
|
28
36
|
}
|
|
@@ -1,10 +1,32 @@
|
|
|
1
1
|
import { A11yWrapperElement } from '../../core/a11y-wrapper-element.js';
|
|
2
2
|
import { syncAttr } from '../../core/dom-sync.js';
|
|
3
|
-
|
|
3
|
+
import { formatString, getString } from '../../core/strings.js';
|
|
4
4
|
/** Whether a link `target` opens a new browsing context — `_blank` or a named window, not `_self`/`_parent`/`_top`. */
|
|
5
5
|
function opensNewContext(target) {
|
|
6
6
|
return !!target && (target === '_blank' || !target.startsWith('_'));
|
|
7
7
|
}
|
|
8
|
+
const HEADING_SELECTOR = 'h1, h2, h3, h4, h5, h6, [role="heading"]';
|
|
9
|
+
/** The target's name for the navigation announcement — its label or heading, never its whole content. */
|
|
10
|
+
function targetName(target, id) {
|
|
11
|
+
const label = target?.getAttribute('aria-label')?.trim();
|
|
12
|
+
if (label)
|
|
13
|
+
return label;
|
|
14
|
+
const labelledBy = (target?.getAttribute('aria-labelledby') ?? '')
|
|
15
|
+
.split(/\s+/)
|
|
16
|
+
.filter(Boolean)
|
|
17
|
+
.map((ref) => document.getElementById(ref)?.textContent?.trim() ?? '')
|
|
18
|
+
.filter(Boolean)
|
|
19
|
+
.join(' ');
|
|
20
|
+
if (labelledBy)
|
|
21
|
+
return labelledBy;
|
|
22
|
+
const heading = target?.matches(HEADING_SELECTOR) ? target : target?.querySelector(HEADING_SELECTOR);
|
|
23
|
+
return heading?.textContent?.trim() || id;
|
|
24
|
+
}
|
|
25
|
+
function prefersReducedMotion() {
|
|
26
|
+
return window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;
|
|
27
|
+
}
|
|
28
|
+
/** Targets currently made focusable by a jump, mapped to their own `tabindex` (`null` = none) to restore on blur. */
|
|
29
|
+
const pendingTabindexRestores = new WeakMap();
|
|
8
30
|
/**
|
|
9
31
|
* Enhances a real, consumer-authored `<a href>`:
|
|
10
32
|
*
|
|
@@ -16,10 +38,16 @@ function opensNewContext(target) {
|
|
|
16
38
|
* - **Internal same-page anchors** (`href="#id"`): native browser jump-links
|
|
17
39
|
* are jarring for keyboard/AT users — no scroll animation, and focus isn't
|
|
18
40
|
* moved to the target, so subsequent Tab presses continue from wherever
|
|
19
|
-
* focus happened to be. This smooth-scrolls to the target
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
41
|
+
* focus happened to be. This smooth-scrolls to the target (instantly under
|
|
42
|
+
* `prefers-reduced-motion: reduce`), moves focus to it (temporarily made
|
|
43
|
+
* focusable via `tabindex="-1"`, its own `tabindex` restored on blur), and
|
|
44
|
+
* announces the navigation — by the target's label or heading — through a
|
|
45
|
+
* live region for screen-reader users. Space also activates (native anchors
|
|
46
|
+
* only activate on Enter).
|
|
47
|
+
*
|
|
48
|
+
* Both built-in strings can be translated: `new-tab-label="…"` /
|
|
49
|
+
* `navigated-label="… {name}"` on this element, else `setStrings({
|
|
50
|
+
* opensInNewTab, navigatedTo })`.
|
|
23
51
|
*
|
|
24
52
|
* ```html
|
|
25
53
|
* <a11y-anchor><a href="#section-2">Jump to section 2</a></a11y-anchor>
|
|
@@ -27,6 +55,9 @@ function opensNewContext(target) {
|
|
|
27
55
|
* ```
|
|
28
56
|
*/
|
|
29
57
|
export class AnchorElement extends A11yWrapperElement {
|
|
58
|
+
static get observedAttributes() {
|
|
59
|
+
return ['new-tab-label', 'navigated-label'];
|
|
60
|
+
}
|
|
30
61
|
/** Each link's own `aria-label` before this element touched it, so the new-tab suffix is never applied twice and can be undone. */
|
|
31
62
|
_originalLabels = new WeakMap();
|
|
32
63
|
_sync() {
|
|
@@ -41,7 +72,8 @@ export class AnchorElement extends A11yWrapperElement {
|
|
|
41
72
|
rel.add('noopener').add('noreferrer');
|
|
42
73
|
syncAttr(anchor, 'rel', [...rel].join(' '));
|
|
43
74
|
const base = originalLabel || anchor.textContent?.trim() || anchor.getAttribute('href') || '';
|
|
44
|
-
|
|
75
|
+
const suffix = this.getAttribute('new-tab-label') ?? getString('opensInNewTab');
|
|
76
|
+
syncAttr(anchor, 'aria-label', `${base} ${suffix}`.trim());
|
|
45
77
|
}
|
|
46
78
|
else {
|
|
47
79
|
syncAttr(anchor, 'aria-label', originalLabel);
|
|
@@ -63,14 +95,27 @@ export class AnchorElement extends A11yWrapperElement {
|
|
|
63
95
|
});
|
|
64
96
|
});
|
|
65
97
|
}
|
|
98
|
+
onStringsChange() {
|
|
99
|
+
this._sync();
|
|
100
|
+
}
|
|
66
101
|
_activateInternalAnchor(id) {
|
|
67
102
|
const target = document.getElementById(id);
|
|
68
|
-
target?.scrollIntoView({ behavior: 'smooth' });
|
|
103
|
+
target?.scrollIntoView({ behavior: prefersReducedMotion() ? 'auto' : 'smooth' });
|
|
69
104
|
setTimeout(() => {
|
|
70
|
-
target
|
|
71
|
-
|
|
72
|
-
|
|
105
|
+
if (!target)
|
|
106
|
+
return;
|
|
107
|
+
// A jump before the previous one's blur must not record our own -1 as the original.
|
|
108
|
+
if (!pendingTabindexRestores.has(target)) {
|
|
109
|
+
pendingTabindexRestores.set(target, target.getAttribute('tabindex'));
|
|
110
|
+
target.addEventListener('blur', () => {
|
|
111
|
+
syncAttr(target, 'tabindex', pendingTabindexRestores.get(target) ?? null);
|
|
112
|
+
pendingTabindexRestores.delete(target);
|
|
113
|
+
}, { once: true });
|
|
114
|
+
}
|
|
115
|
+
target.setAttribute('tabindex', '-1');
|
|
116
|
+
target.focus({ preventScroll: true });
|
|
73
117
|
}, 100);
|
|
118
|
+
const template = this.getAttribute('navigated-label') ?? getString('navigatedTo');
|
|
74
119
|
const announcement = document.createElement('div');
|
|
75
120
|
announcement.setAttribute('role', 'status');
|
|
76
121
|
announcement.setAttribute('aria-live', 'polite');
|
|
@@ -79,7 +124,7 @@ export class AnchorElement extends A11yWrapperElement {
|
|
|
79
124
|
document.body.appendChild(announcement);
|
|
80
125
|
// Delay content so AT registers the live region before it receives text.
|
|
81
126
|
setTimeout(() => {
|
|
82
|
-
announcement.textContent =
|
|
127
|
+
announcement.textContent = formatString(template, { name: targetName(target, id) });
|
|
83
128
|
setTimeout(() => announcement.remove(), 3000);
|
|
84
129
|
}, 100);
|
|
85
130
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchor.element.js","sourceRoot":"","sources":["../../../src/components/anchor/anchor.element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEhE,uHAAuH;AACvH,SAAS,eAAe,CAAC,MAAqB;IAC5C,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,gBAAgB,GAAG,0CAA0C,CAAC;AAEpE,yGAAyG;AACzG,SAAS,UAAU,CAAC,MAA0B,EAAE,EAAU;IACxD,MAAM,KAAK,GAAG,MAAM,EAAE,YAAY,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACzD,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IAExB,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC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,MAAM,CAAC,MAAM,CAAC,CAAC;gBACzC,CAAC,EACD,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAC;YACJ,CAAC;YACD,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YACtC,MAAM,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QACxC,CAAC,EAAE,GAAG,CAAC,CAAC;QAER,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,IAAI,SAAS,CAAC,aAAa,CAAC,CAAC;QAClF,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACnD,YAAY,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC5C,YAAY,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QACjD,YAAY,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACjD,YAAY,CAAC,SAAS,GAAG,sBAAsB,CAAC;QAChD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QACxC,yEAAyE;QACzE,UAAU,CAAC,GAAG,EAAE;YACd,YAAY,CAAC,WAAW,GAAG,YAAY,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;YACpF,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,CAAC;QAChD,CAAC,EAAE,GAAG,CAAC,CAAC;IACV,CAAC;CACF"}
|
|
@@ -3,4 +3,6 @@ if (!customElements.get('a11y-anchor')) {
|
|
|
3
3
|
customElements.define('a11y-anchor', AnchorElement);
|
|
4
4
|
}
|
|
5
5
|
export { AnchorElement };
|
|
6
|
+
// Re-exported so zero-build `<script type="module">` users can reach them too.
|
|
7
|
+
export { resetStrings, setStrings } from '../../core/strings.js';
|
|
6
8
|
//# sourceMappingURL=define.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../../src/components/anchor/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;IACvC,cAAc,CAAC,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AACtD,CAAC;AAQD,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,+EAA+E;AAC/E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -16,6 +16,8 @@ export declare class AvatarElement extends A11yElement {
|
|
|
16
16
|
private _showsImg;
|
|
17
17
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
18
18
|
protected onBeforeRender(): void;
|
|
19
|
+
/** The built-in name is only used without an image, and re-rendering would reload the <img>. */
|
|
20
|
+
protected onStringsChange(): void;
|
|
19
21
|
protected render(): Raw;
|
|
20
22
|
protected onAfterRender(): void;
|
|
21
23
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { A11yElement } from '../../core/a11y-element.js';
|
|
2
|
+
import { getString } from '../../core/strings.js';
|
|
2
3
|
import { html } from '../../core/template.js';
|
|
3
4
|
/**
|
|
4
5
|
* A user avatar image with an initials fallback.
|
|
@@ -43,15 +44,21 @@ export class AvatarElement extends A11yElement {
|
|
|
43
44
|
}
|
|
44
45
|
else {
|
|
45
46
|
this.setAttribute('role', 'img');
|
|
46
|
-
this.setAttribute('aria-label', this.alt || this.optionalStringAttr('initials') || '
|
|
47
|
+
this.setAttribute('aria-label', this.alt || this.optionalStringAttr('initials') || getString('avatar'));
|
|
47
48
|
}
|
|
48
49
|
}
|
|
50
|
+
/** The built-in name is only used without an image, and re-rendering would reload the <img>. */
|
|
51
|
+
onStringsChange() {
|
|
52
|
+
if (!this._showsImg())
|
|
53
|
+
this.update();
|
|
54
|
+
}
|
|
49
55
|
render() {
|
|
50
|
-
const initials = this.optionalStringAttr('initials');
|
|
51
56
|
if (this._showsImg()) {
|
|
52
57
|
const src = this.optionalStringAttr('src');
|
|
53
|
-
|
|
58
|
+
// No initials alongside the image: if it fails, onAfterRender re-renders to the initials branch.
|
|
59
|
+
return html `<img class="a11y-avatar__img" src="${src}" alt="${this.alt}" loading="lazy" decoding="async">`;
|
|
54
60
|
}
|
|
61
|
+
const initials = this.optionalStringAttr('initials');
|
|
55
62
|
return html `<span class="a11y-avatar__initials" aria-hidden="true">${initials}</span>`;
|
|
56
63
|
}
|
|
57
64
|
onAfterRender() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.element.js","sourceRoot":"","sources":["../../../src/components/avatar/avatar.element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAY,MAAM,wBAAwB,CAAC;AAIxD;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C,MAAM,KAAK,kBAAkB;QAC3B,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IAED,kGAAkG;IAC1F,UAAU,GAAG,KAAK,CAAC;IAE3B,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,GAAG,CAAC,KAAa;QACnB,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,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CAAC,CAAC,CAAC;QAC1G,CAAC;IACH,CAAC;IAED,gGAAgG;IAC7E,eAAe;QAChC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IACvC,CAAC;IAEkB,MAAM;QACvB,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;YACrB,MAAM,GAAG,GAAG,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAE,CAAC;YAC5C,iGAAiG;YACjG,OAAO,IAAI,CAAA,sCAAsC,GAAG,UAAU,IAAI,CAAC,GAAG,oCAAoC,CAAC;QAC7G,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QACrD,OAAO,IAAI,CAAA,0DAA0D,QAAQ,SAAS,CAAC;IACzF,CAAC;IAEkB,aAAa;QAC9B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YAAE,OAAO;QAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,CAAmB,mBAAmB,CAAC,CAAC;QACtE,IAAI,CAAC,GAAG;YAAE,OAAO;QAEjB,qEAAqE;QACrE,gEAAgE;QAChE,gEAAgE;QAChE,+DAA+D;QAC/D,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE;YAC7B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -3,4 +3,6 @@ if (!customElements.get('a11y-avatar')) {
|
|
|
3
3
|
customElements.define('a11y-avatar', AvatarElement);
|
|
4
4
|
}
|
|
5
5
|
export { AvatarElement };
|
|
6
|
+
// Re-exported so zero-build `<script type="module">` users can reach them too.
|
|
7
|
+
export { resetStrings, setStrings } from '../../core/strings.js';
|
|
6
8
|
//# sourceMappingURL=define.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../../src/components/avatar/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;IACvC,cAAc,CAAC,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AACtD,CAAC;AAQD,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,+EAA+E;AAC/E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -28,8 +28,6 @@ export class CheckboxElement extends A11yWrapperElement {
|
|
|
28
28
|
static get observedAttributes() {
|
|
29
29
|
return ['label', 'indeterminate'];
|
|
30
30
|
}
|
|
31
|
-
/** Called with the input's current `checked` state on every native `change` event. */
|
|
32
|
-
onChange;
|
|
33
31
|
getValue() {
|
|
34
32
|
return this._input()?.checked ?? false;
|
|
35
33
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.element.js","sourceRoot":"","sources":["../../../src/components/checkbox/checkbox.element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,OAAO,eAAgB,SAAQ,kBAAkB;IACrD,MAAM,KAAK,kBAAkB;QAC3B,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACpC,CAAC;IAMD,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,EAAE,EAAE,OAAO,IAAI,KAAK,CAAC;IACzC,CAAC;IAED,QAAQ,CAAC,OAAgB;QACvB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC5B,IAAI,KAAK;YAAE,KAAK,CAAC,OAAO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I,IAAI,GAAG,OAAO,CAAC,aAAa,CAAc,uBAAuB,CAAC,CAAC;QACvE,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,EAAE,MAAM,EAAE,CAAC;YACf,OAAO;QACT,CAAC;QACD,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YACtC,IAAI,CAAC,SAAS,GAAG,sBAAsB,CAAC;YACxC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;QACD,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -3,4 +3,6 @@ if (!customElements.get('a11y-checkbox')) {
|
|
|
3
3
|
customElements.define('a11y-checkbox', CheckboxElement);
|
|
4
4
|
}
|
|
5
5
|
export { CheckboxElement };
|
|
6
|
+
// Re-exported so zero-build `<script type="module">` users can reach them too.
|
|
7
|
+
export { resetStrings, setStrings } from '../../core/strings.js';
|
|
6
8
|
//# sourceMappingURL=define.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../../src/components/checkbox/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC;IACzC,cAAc,CAAC,MAAM,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;AAC1D,CAAC;AAQD,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,+EAA+E;AAC/E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -3,4 +3,6 @@ if (!customElements.get('a11y-focusable')) {
|
|
|
3
3
|
customElements.define('a11y-focusable', FocusableElement);
|
|
4
4
|
}
|
|
5
5
|
export { FocusableElement };
|
|
6
|
+
// Re-exported so zero-build `<script type="module">` users can reach them too.
|
|
7
|
+
export { resetStrings, setStrings } from '../../core/strings.js';
|
|
6
8
|
//# sourceMappingURL=define.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../../src/components/focusable/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE,CAAC;IAC1C,cAAc,CAAC,MAAM,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;AAC5D,CAAC;AAQD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,+EAA+E;AAC/E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focusable.element.js","sourceRoot":"","sources":["../../../src/components/focusable/focusable.element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IAC/C,MAAM,KAAK,kBAAkB;QAC3B,OAAO,CAAC,YAAY,CAAC,CAAC;IACxB,CAAC;IAEO,iBAAiB,GAAG,KAAK,CAAC;IAEf,cAAc;QAC/B,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACpC,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QAEnC,IAAI,CAAC,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC;YAC7F,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;YAC9B,OAAO,CAAC,IAAI,CAAC,sFAAsF,CAAC,CAAC;QACvG,CAAC;IACH,CAAC;IAED,0EAA0E;IAC1E,iFAAiF;IAC9D,MAAM;QACvB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEkB,aAAa;QAC9B,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;YACjC,MAAM,EAAE,GAAG,CAAkB,CAAC;YAC9B,IAAI,EAAE,CAAC,GAAG,KAAK,OAAO,IAAI,EAAE,CAAC,GAAG,KAAK,GAAG;gBAAE,OAAO;YACjD,EAAE,CAAC,cAAc,EAAE,CAAC;YACpB,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InputElement } from './input.element.js';
|
|
2
|
+
declare global {
|
|
3
|
+
interface HTMLElementTagNameMap {
|
|
4
|
+
'a11y-input': InputElement;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export { InputElement };
|
|
8
|
+
export { bindField } from '../../core/field.js';
|
|
9
|
+
export { resetStrings, setStrings } from '../../core/strings.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InputElement } from './input.element.js';
|
|
2
|
+
if (!customElements.get('a11y-input')) {
|
|
3
|
+
customElements.define('a11y-input', InputElement);
|
|
4
|
+
}
|
|
5
|
+
export { InputElement };
|
|
6
|
+
// Re-exported so zero-build `<script type="module">` users can reach them too.
|
|
7
|
+
export { bindField } from '../../core/field.js';
|
|
8
|
+
export { resetStrings, setStrings } from '../../core/strings.js';
|
|
9
|
+
//# sourceMappingURL=define.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../../src/components/input/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;IACtC,cAAc,CAAC,MAAM,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AACpD,CAAC;AAQD,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,+EAA+E;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { A11yFieldElement } from '../../core/a11y-field-element.js';
|
|
2
|
+
/**
|
|
3
|
+
* A text field built from a real `<input>` and optional parts: an
|
|
4
|
+
* `<a11y-label>`, any number of `<a11y-hint>`s, an `<a11y-error>` the
|
|
5
|
+
* validation message is rendered into, and an `<a11y-counter>` (with
|
|
6
|
+
* `maxlength`). See {@link A11yFieldElement} for how they're wired.
|
|
7
|
+
*
|
|
8
|
+
* ```html
|
|
9
|
+
* <a11y-input type-mismatch-message="Enter an email like name@example.com">
|
|
10
|
+
* <a11y-label>Email</a11y-label>
|
|
11
|
+
* <input type="email" name="email" required>
|
|
12
|
+
* <a11y-hint>We never share it.</a11y-hint>
|
|
13
|
+
* <a11y-error></a11y-error>
|
|
14
|
+
* </a11y-input>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Any text-like `type` works; checkbox, radio, range, color, file and hidden
|
|
18
|
+
* inputs are left alone (use `<a11y-checkbox>`, `<a11y-radio-group>`, …).
|
|
19
|
+
*/
|
|
20
|
+
export declare class InputElement extends A11yFieldElement {
|
|
21
|
+
protected readonly controlSelector = "input:not([type=\"checkbox\"], [type=\"radio\"], [type=\"range\"], [type=\"color\"], [type=\"file\"], [type=\"hidden\"], [type=\"submit\"], [type=\"reset\"], [type=\"button\"], [type=\"image\"])";
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { A11yFieldElement } from '../../core/a11y-field-element.js';
|
|
2
|
+
/**
|
|
3
|
+
* A text field built from a real `<input>` and optional parts: an
|
|
4
|
+
* `<a11y-label>`, any number of `<a11y-hint>`s, an `<a11y-error>` the
|
|
5
|
+
* validation message is rendered into, and an `<a11y-counter>` (with
|
|
6
|
+
* `maxlength`). See {@link A11yFieldElement} for how they're wired.
|
|
7
|
+
*
|
|
8
|
+
* ```html
|
|
9
|
+
* <a11y-input type-mismatch-message="Enter an email like name@example.com">
|
|
10
|
+
* <a11y-label>Email</a11y-label>
|
|
11
|
+
* <input type="email" name="email" required>
|
|
12
|
+
* <a11y-hint>We never share it.</a11y-hint>
|
|
13
|
+
* <a11y-error></a11y-error>
|
|
14
|
+
* </a11y-input>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Any text-like `type` works; checkbox, radio, range, color, file and hidden
|
|
18
|
+
* inputs are left alone (use `<a11y-checkbox>`, `<a11y-radio-group>`, …).
|
|
19
|
+
*/
|
|
20
|
+
export class InputElement extends A11yFieldElement {
|
|
21
|
+
controlSelector = 'input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="hidden"], [type="submit"], [type="reset"], [type="button"], [type="image"])';
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=input.element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.element.js","sourceRoot":"","sources":["../../../src/components/input/input.element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,YAAa,SAAQ,gBAAgB;IAC7B,eAAe,GAChC,gLAAgL,CAAC;CACpL"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LabelElement } from './label.element.js';
|
|
2
|
+
if (!customElements.get('a11y-label')) {
|
|
3
|
+
customElements.define('a11y-label', LabelElement);
|
|
4
|
+
}
|
|
5
|
+
export { LabelElement };
|
|
6
|
+
// Re-exported so zero-build `<script type="module">` users can reach them too.
|
|
7
|
+
export { resetStrings, setStrings } from '../../core/strings.js';
|
|
8
|
+
//# sourceMappingURL=define.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../../src/components/label/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;IACtC,cAAc,CAAC,MAAM,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AACpD,CAAC;AAQD,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,+EAA+E;AAC/E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { A11yWrapperElement } from '../../core/a11y-wrapper-element.js';
|
|
2
|
+
/**
|
|
3
|
+
* A label that renders a real `<label class="a11y-label">` around its
|
|
4
|
+
* content — a custom element can't itself *be* a `<label>`, and only a real
|
|
5
|
+
* one gives click-to-focus and native accessible naming.
|
|
6
|
+
*
|
|
7
|
+
* Inside `<a11y-input>`/`<a11y-textarea>` it's linked to the control
|
|
8
|
+
* automatically. On its own, `for` is forwarded to the inner `<label>`:
|
|
9
|
+
*
|
|
10
|
+
* ```html
|
|
11
|
+
* <a11y-label for="search">Search</a11y-label>
|
|
12
|
+
* <input id="search" type="search">
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* The required marker (`*`) is CSS only and hidden from assistive tech,
|
|
16
|
+
* which already announces the control's native `required`. It shows inside
|
|
17
|
+
* a field whose control is required, or with the `required` attribute here.
|
|
18
|
+
*/
|
|
19
|
+
export declare class LabelElement extends A11yWrapperElement {
|
|
20
|
+
static get observedAttributes(): string[];
|
|
21
|
+
/** Whether the inner label's `for` came from this element's own `for`, so removing that one clears it. */
|
|
22
|
+
private _forwardedFor;
|
|
23
|
+
/**
|
|
24
|
+
* The real `<label>` this element renders, built on first access. A field
|
|
25
|
+
* reads this while syncing, which can run before this element's own
|
|
26
|
+
* `connectedCallback` (the field comes first in tree order), so it links
|
|
27
|
+
* the real label straight away instead of on a later sync.
|
|
28
|
+
*/
|
|
29
|
+
get label(): HTMLLabelElement;
|
|
30
|
+
protected observerInit(): MutationObserverInit;
|
|
31
|
+
protected _sync(): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { A11yWrapperElement } from '../../core/a11y-wrapper-element.js';
|
|
2
|
+
import { syncAttr } from '../../core/dom-sync.js';
|
|
3
|
+
/**
|
|
4
|
+
* A label that renders a real `<label class="a11y-label">` around its
|
|
5
|
+
* content — a custom element can't itself *be* a `<label>`, and only a real
|
|
6
|
+
* one gives click-to-focus and native accessible naming.
|
|
7
|
+
*
|
|
8
|
+
* Inside `<a11y-input>`/`<a11y-textarea>` it's linked to the control
|
|
9
|
+
* automatically. On its own, `for` is forwarded to the inner `<label>`:
|
|
10
|
+
*
|
|
11
|
+
* ```html
|
|
12
|
+
* <a11y-label for="search">Search</a11y-label>
|
|
13
|
+
* <input id="search" type="search">
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* The required marker (`*`) is CSS only and hidden from assistive tech,
|
|
17
|
+
* which already announces the control's native `required`. It shows inside
|
|
18
|
+
* a field whose control is required, or with the `required` attribute here.
|
|
19
|
+
*/
|
|
20
|
+
export class LabelElement extends A11yWrapperElement {
|
|
21
|
+
static get observedAttributes() {
|
|
22
|
+
return ['for'];
|
|
23
|
+
}
|
|
24
|
+
/** Whether the inner label's `for` came from this element's own `for`, so removing that one clears it. */
|
|
25
|
+
_forwardedFor = false;
|
|
26
|
+
/**
|
|
27
|
+
* The real `<label>` this element renders, built on first access. A field
|
|
28
|
+
* reads this while syncing, which can run before this element's own
|
|
29
|
+
* `connectedCallback` (the field comes first in tree order), so it links
|
|
30
|
+
* the real label straight away instead of on a later sync.
|
|
31
|
+
*/
|
|
32
|
+
get label() {
|
|
33
|
+
let label = this.querySelector(':scope > label.a11y-label');
|
|
34
|
+
if (!label) {
|
|
35
|
+
label = document.createElement('label');
|
|
36
|
+
label.className = 'a11y-label';
|
|
37
|
+
}
|
|
38
|
+
// Move the author's content (and anything added later) into the real label.
|
|
39
|
+
for (const node of [...this.childNodes])
|
|
40
|
+
if (node !== label)
|
|
41
|
+
label.appendChild(node);
|
|
42
|
+
if (label.parentNode !== this)
|
|
43
|
+
this.appendChild(label);
|
|
44
|
+
return label;
|
|
45
|
+
}
|
|
46
|
+
observerInit() {
|
|
47
|
+
return { childList: true };
|
|
48
|
+
}
|
|
49
|
+
_sync() {
|
|
50
|
+
const label = this.label;
|
|
51
|
+
const forId = this.getAttribute('for');
|
|
52
|
+
if (forId != null) {
|
|
53
|
+
syncAttr(label, 'for', forId);
|
|
54
|
+
this._forwardedFor = true;
|
|
55
|
+
}
|
|
56
|
+
else if (this._forwardedFor) {
|
|
57
|
+
syncAttr(label, 'for', null);
|
|
58
|
+
this._forwardedFor = false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=label.element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.element.js","sourceRoot":"","sources":["../../../src/components/label/label.element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,YAAa,SAAQ,kBAAkB;IAClD,MAAM,KAAK,kBAAkB;QAC3B,OAAO,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAED,0GAA0G;IAClG,aAAa,GAAG,KAAK,CAAC;IAE9B;;;;;OAKG;IACH,IAAI,KAAK;QACP,IAAI,KAAK,GAAG,IAAI,CAAC,aAAa,CAAmB,2BAA2B,CAAC,CAAC;QAC9E,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YACxC,KAAK,CAAC,SAAS,GAAG,YAAY,CAAC;QACjC,CAAC;QACD,4EAA4E;QAC5E,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC;YAAE,IAAI,IAAI,KAAK,KAAK;gBAAE,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACrF,IAAI,KAAK,CAAC,UAAU,KAAK,IAAI;YAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACvD,OAAO,KAAK,CAAC;IACf,CAAC;IAEkB,YAAY;QAC7B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAC7B,CAAC;IAEkB,KAAK;QACtB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAEzB,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACvC,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAClB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAC9B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;aAAM,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YAC9B,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;YAC7B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC7B,CAAC;IACH,CAAC;CACF"}
|
|
@@ -3,4 +3,6 @@ if (!customElements.get('a11y-picture')) {
|
|
|
3
3
|
customElements.define('a11y-picture', PictureElement);
|
|
4
4
|
}
|
|
5
5
|
export { PictureElement };
|
|
6
|
+
// Re-exported so zero-build `<script type="module">` users can reach them too.
|
|
7
|
+
export { resetStrings, setStrings } from '../../core/strings.js';
|
|
6
8
|
//# sourceMappingURL=define.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../../src/components/picture/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;IACxC,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;AACxD,CAAC;AAQD,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,+EAA+E;AAC/E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"picture.element.js","sourceRoot":"","sources":["../../../src/components/picture/picture.element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,cAAe,SAAQ,kBAAkB;IACjC,YAAY;QAC7B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;IACxF,CAAC;IAEkB,KAAK;QACtB,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,GAAG;YAAE,OAAO;QAEjB,wEAAwE;QACxE,uEAAuE;QACvE,oEAAoE;QACpE,2EAA2E;QAC3E,wEAAwE;QACxE,0DAA0D;QAC1D,SAAS,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;QACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QAEjC,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,UAAU,GAAG,CAAC,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QAClD,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC;QAEnE,QAAQ,CAAC,IAAI,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC;CACF"}
|
|
@@ -3,4 +3,6 @@ if (!customElements.get('a11y-progress')) {
|
|
|
3
3
|
customElements.define('a11y-progress', ProgressElement);
|
|
4
4
|
}
|
|
5
5
|
export { ProgressElement };
|
|
6
|
+
// Re-exported so zero-build `<script type="module">` users can reach them too.
|
|
7
|
+
export { resetStrings, setStrings } from '../../core/strings.js';
|
|
6
8
|
//# sourceMappingURL=define.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../../src/components/progress/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC;IACzC,cAAc,CAAC,MAAM,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;AAC1D,CAAC;AAQD,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,+EAA+E;AAC/E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { A11yElement } from '../../core/a11y-element.js';
|
|
2
|
+
import { getString } from '../../core/strings.js';
|
|
2
3
|
import { html } from '../../core/template.js';
|
|
3
4
|
let uidCounter = 0;
|
|
4
5
|
const nextLabelId = () => `a11y-progress-label-${++uidCounter}`;
|
|
@@ -32,12 +33,15 @@ export class ProgressElement extends A11yElement {
|
|
|
32
33
|
onBeforeRender() {
|
|
33
34
|
this.classList.add('a11y-progress');
|
|
34
35
|
}
|
|
36
|
+
onStringsChange() {
|
|
37
|
+
this.update();
|
|
38
|
+
}
|
|
35
39
|
render() {
|
|
36
40
|
const { value, max } = this;
|
|
37
41
|
const label = this.optionalStringAttr('label');
|
|
38
42
|
const ariaLabel = this.optionalStringAttr('aria-label');
|
|
39
43
|
const labelMarkup = label ? html `<span class="a11y-progress__label" id="${this._labelId}">${label}</span>` : '';
|
|
40
|
-
const progressAttrs = html `class="a11y-progress__bar"${value !== undefined ? html ` value="${value}"` : ''} max="${max}"${label ? html ` aria-labelledby="${this._labelId}"` : ariaLabel ? html ` aria-label="${ariaLabel}"` : html ` aria-label="
|
|
44
|
+
const progressAttrs = html `class="a11y-progress__bar"${value !== undefined ? html ` value="${value}"` : ''} max="${max}"${label ? html ` aria-labelledby="${this._labelId}"` : ariaLabel ? html ` aria-label="${ariaLabel}"` : html ` aria-label="${getString('progress')}"`}`;
|
|
41
45
|
return `${labelMarkup}<progress ${progressAttrs}></progress>`;
|
|
42
46
|
}
|
|
43
47
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.element.js","sourceRoot":"","sources":["../../../src/components/progress/progress.element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C,IAAI,UAAU,GAAG,CAAC,CAAC;AACnB,MAAM,WAAW,GAAG,GAAW,EAAE,CAAC,uBAAuB,EAAE,UAAU,EAAE,CAAC;AAExE;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAgB,SAAQ,WAAW;IAC9C,MAAM,KAAK,kBAAkB;QAC3B,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;IAEO,QAAQ,GAAG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WAAW,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,SAAS,GAAG,IACnH,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA,qBAAqB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAA,gBAAgB,SAAS,GAAG,CAAC,CAAC,CAAC,IAAI,CAAA,gBAAgB,SAAS,CAAC,UAAU,CAAC,GAC9I,EAAE,CAAC;QAEH,OAAO,GAAG,WAAW,aAAa,aAAa,cAAc,CAAC;IAChE,CAAC;CACF"}
|
|
@@ -3,4 +3,6 @@ if (!customElements.get('a11y-radio-group')) {
|
|
|
3
3
|
customElements.define('a11y-radio-group', RadioGroupElement);
|
|
4
4
|
}
|
|
5
5
|
export { RadioGroupElement };
|
|
6
|
+
// Re-exported so zero-build `<script type="module">` users can reach them too.
|
|
7
|
+
export { resetStrings, setStrings } from '../../core/strings.js';
|
|
6
8
|
//# sourceMappingURL=define.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../../src/components/radio-group/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAC5C,cAAc,CAAC,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAAC;AAC/D,CAAC;AAQD,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,+EAA+E;AAC/E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|