@zerolith/a11y 0.0.0-stage → 0.1.0-alpha.10
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/LICENSE +201 -0
- package/README.md +33 -2
- package/dist/announce.d.ts +26 -0
- package/dist/announce.d.ts.map +1 -0
- package/dist/announce.js +58 -0
- package/dist/announce.js.map +1 -0
- package/dist/focus.d.ts +58 -0
- package/dist/focus.d.ts.map +1 -0
- package/dist/focus.js +240 -0
- package/dist/focus.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/media.d.ts +12 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +32 -0
- package/dist/media.js.map +1 -0
- package/dist/production/announce.js +4 -0
- package/dist/production/announce.js.map +1 -0
- package/dist/production/focus.js +2 -0
- package/dist/production/focus.js.map +1 -0
- package/dist/production/index.js +2 -0
- package/dist/production/index.js.map +1 -0
- package/dist/production/media.js +2 -0
- package/dist/production/media.js.map +1 -0
- package/package.json +50 -5
- package/src/announce.ts +79 -0
- package/src/focus.ts +331 -0
- package/src/index.ts +11 -0
- package/src/media.ts +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @zerolith/a11y
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The accessibility primitives every component library rebuilds, as plain functions over the DOM with no dependency beyond `zerolith`.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { html } from "zerolith";
|
|
7
|
+
import { createAnnouncer, focusTrap, rovingTabindex, visuallyHidden } from "@zerolith/a11y";
|
|
8
|
+
|
|
9
|
+
html`<div role="dialog" aria-modal="true" ref=${focusTrap()}>...</div>`;
|
|
10
|
+
html`<div role="tablist" ref=${rovingTabindex({ orientation: "horizontal" })}>...</div>`;
|
|
11
|
+
html`<span class=${visuallyHidden}>Opens in a new window</span>`;
|
|
12
|
+
createAnnouncer().announce("Saved");
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
- `focusTrap` keeps Tab inside an element, moves focus in on attach, and returns it on removal.
|
|
16
|
+
- `rovingTabindex` makes one item of a composite widget tabbable and moves between items with the arrow keys, Home, and End.
|
|
17
|
+
- `createAnnouncer` speaks messages through a live region.
|
|
18
|
+
- `focusOrigin` tells keyboard focus from pointer focus, as a signal and as a `data-focus-origin` attribute on the root element for styling.
|
|
19
|
+
- `visuallyHidden` is the clip pattern for text meant for assistive technology only.
|
|
20
|
+
- `mediaQuery`, `forcedColors`, and `reducedMotion` are media queries as signals.
|
|
21
|
+
|
|
22
|
+
The guide is on the [docs site](https://zerolith.dev/guide/accessibility/).
|
|
23
|
+
|
|
24
|
+
Status: alpha. Install with `npm install @zerolith/a11y@alpha`; the API may change before 1.0.
|
|
25
|
+
|
|
26
|
+
## Documentation
|
|
27
|
+
|
|
28
|
+
- The [accessibility guide](https://zerolith.dev/guide/accessibility/) explains it with examples that run as tests.
|
|
29
|
+
- The [reference](https://zerolith.dev/reference/zerolith-a11y/) lists every export, generated from the source.
|
|
30
|
+
- New to zerolith? The [tutorial](https://zerolith.dev/learn/) builds an app step by step, and the [playground](https://zerolith.dev/playground/) runs code in the browser.
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
|
|
34
|
+
Apache-2.0. See `LICENSE`.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The live announcer and the visually hidden style it uses: text for
|
|
3
|
+
* assistive technology that takes no space on screen.
|
|
4
|
+
*/
|
|
5
|
+
import { type Styles } from "zerolith";
|
|
6
|
+
/** The clip pattern that hides an element visually while assistive technology still reads it. */
|
|
7
|
+
export declare const visuallyHidden: Styles;
|
|
8
|
+
/** How urgently a message is read. */
|
|
9
|
+
export type Politeness = "polite" | "assertive";
|
|
10
|
+
/** What `createAnnouncer` returns. */
|
|
11
|
+
export interface Announcer {
|
|
12
|
+
/** Queues a message for the live region; `assertive` interrupts what is being read. */
|
|
13
|
+
announce(message: string, politeness?: Politeness): void;
|
|
14
|
+
/** Removes the live regions. */
|
|
15
|
+
dispose(): void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates a pair of live regions, one polite and one assertive, appended to
|
|
19
|
+
* the document body at once, so assistive technology knows them before the
|
|
20
|
+
* first message, and hidden visually by inline styles, which hold in any
|
|
21
|
+
* document `doc` names. Each announcement clears the
|
|
22
|
+
* region and writes the message on the next task, so repeating a message
|
|
23
|
+
* is read again.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createAnnouncer(doc?: Document): Announcer;
|
|
26
|
+
//# sourceMappingURL=announce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"announce.d.ts","sourceRoot":"","sources":["../src/announce.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,MAAM,EAAO,MAAM,UAAU,CAAC;AAE5C,iGAAiG;AACjG,eAAO,MAAM,cAAc,EAAE,MAE5B,CAAC;AAEF,sCAAsC;AACtC,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEhD,sCAAsC;AACtC,MAAM,WAAW,SAAS;IAEtB,uFAAuF;IACvF,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IACzD,gCAAgC;IAChC,OAAO,IAAI,IAAI,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,GAAG,GAAE,QAAmB,GAAG,SAAS,CA+CnE"}
|
package/dist/announce.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The live announcer and the visually hidden style it uses: text for
|
|
3
|
+
* assistive technology that takes no space on screen.
|
|
4
|
+
*/
|
|
5
|
+
import { css } from "zerolith";
|
|
6
|
+
/** The clip pattern that hides an element visually while assistive technology still reads it. */
|
|
7
|
+
export const visuallyHidden = css `
|
|
8
|
+
:scope { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
|
|
9
|
+
`;
|
|
10
|
+
/**
|
|
11
|
+
* Creates a pair of live regions, one polite and one assertive, appended to
|
|
12
|
+
* the document body at once, so assistive technology knows them before the
|
|
13
|
+
* first message, and hidden visually by inline styles, which hold in any
|
|
14
|
+
* document `doc` names. Each announcement clears the
|
|
15
|
+
* region and writes the message on the next task, so repeating a message
|
|
16
|
+
* is read again.
|
|
17
|
+
*/
|
|
18
|
+
export function createAnnouncer(doc = document) {
|
|
19
|
+
const regions = new Map();
|
|
20
|
+
const region = (politeness) => {
|
|
21
|
+
let element = regions.get(politeness);
|
|
22
|
+
if (element === undefined) {
|
|
23
|
+
element = doc.createElement("div");
|
|
24
|
+
element.setAttribute("aria-live", politeness);
|
|
25
|
+
element.setAttribute("aria-atomic", "true");
|
|
26
|
+
element.setAttribute("role", politeness === "assertive" ? "alert" : "status");
|
|
27
|
+
element.className = `zl-s ${visuallyHidden.scope}`;
|
|
28
|
+
element.setAttribute("style", "position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;");
|
|
29
|
+
doc.body.append(element);
|
|
30
|
+
regions.set(politeness, element);
|
|
31
|
+
}
|
|
32
|
+
return element;
|
|
33
|
+
};
|
|
34
|
+
region("polite");
|
|
35
|
+
region("assertive");
|
|
36
|
+
const timers = new Map();
|
|
37
|
+
return {
|
|
38
|
+
announce(message, politeness = "polite") {
|
|
39
|
+
const element = region(politeness);
|
|
40
|
+
element.textContent = "";
|
|
41
|
+
clearTimeout(timers.get(politeness));
|
|
42
|
+
timers.set(politeness, setTimeout(() => {
|
|
43
|
+
element.textContent = message;
|
|
44
|
+
}, 0));
|
|
45
|
+
},
|
|
46
|
+
dispose() {
|
|
47
|
+
for (const timer of timers.values()) {
|
|
48
|
+
clearTimeout(timer);
|
|
49
|
+
}
|
|
50
|
+
timers.clear();
|
|
51
|
+
for (const element of regions.values()) {
|
|
52
|
+
element.remove();
|
|
53
|
+
}
|
|
54
|
+
regions.clear();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=announce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"announce.js","sourceRoot":"","sources":["../src/announce.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAe,GAAG,EAAE,MAAM,UAAU,CAAC;AAE5C,iGAAiG;AACjG,MAAM,CAAC,MAAM,cAAc,GAAW,GAAG,CAAA;;CAExC,CAAC;AAcF;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,GAAG,GAAa,QAAQ;IAEpD,MAAM,OAAO,GAAG,IAAI,GAAG,EAA2B,CAAC;IACnD,MAAM,MAAM,GAAG,CAAC,UAAsB,EAAe,EAAE;QAEnD,IAAI,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACtC,IAAI,OAAO,KAAK,SAAS,EACzB,CAAC;YACG,OAAO,GAAG,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YACnC,OAAO,CAAC,YAAY,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;YAC9C,OAAO,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;YAC5C,OAAO,CAAC,YAAY,CA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ACJ,CAAC;AACN,CAAC"}
|
package/dist/focus.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Focus management: the trap a dialog needs, the roving tabindex a composite
|
|
3
|
+
* widget needs, and a monitor that tells keyboard focus from pointer focus.
|
|
4
|
+
* The trap and the roving tabindex are `ref` callbacks, so they attach when
|
|
5
|
+
* the element is created and clean up when its template is removed.
|
|
6
|
+
*/
|
|
7
|
+
import { type ReadableSignal } from "zerolith";
|
|
8
|
+
/** The elements inside `root` that take Tab focus, in document order, skipping anything hidden. */
|
|
9
|
+
export declare function focusables(root: Element): HTMLElement[];
|
|
10
|
+
/** Options for `focusTrap`. */
|
|
11
|
+
export interface FocusTrapOptions {
|
|
12
|
+
/** What receives focus on attach: a selector inside the element, an element, or false to leave focus alone. Defaults to the first focusable, or the element itself. */
|
|
13
|
+
initial?: string | HTMLElement | false;
|
|
14
|
+
/** Returns focus to the element that had it before the trap attached. Defaults to true. */
|
|
15
|
+
restore?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A `ref` that keeps Tab and Shift+Tab inside the element, pulls focus back
|
|
19
|
+
* when it lands outside, moves focus in once the element is in the document,
|
|
20
|
+
* and returns it where it came from when the element's template is removed.
|
|
21
|
+
* With traps on several elements, as when a dialog opens a confirmation,
|
|
22
|
+
* only the newest acts until its template is removed.
|
|
23
|
+
*/
|
|
24
|
+
export declare function focusTrap(options?: FocusTrapOptions): (element: Element) => void;
|
|
25
|
+
/** Options for `rovingTabindex`. */
|
|
26
|
+
export interface RovingOptions {
|
|
27
|
+
/** The selector of the items. Defaults to the ARIA roles of composite widgets plus `[data-roving]`. */
|
|
28
|
+
items?: string;
|
|
29
|
+
/** Which arrow keys move: `horizontal` (left and right), `vertical` (up and down), or `both`. Defaults to both. */
|
|
30
|
+
orientation?: "horizontal" | "vertical" | "both";
|
|
31
|
+
/** Wraps from the last item to the first and back. Defaults to true. */
|
|
32
|
+
loop?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A `ref` for a composite widget: exactly one item is in the Tab order, the
|
|
36
|
+
* arrow keys, Home, and End move between items, and the item that was
|
|
37
|
+
* selected or checked starts as the current one. Disabled, hidden, and
|
|
38
|
+
* inert items are skipped, as the children of a collapsed tree item are.
|
|
39
|
+
*/
|
|
40
|
+
export declare function rovingTabindex(options?: RovingOptions): (element: Element) => void;
|
|
41
|
+
/** How the element that has focus got it. */
|
|
42
|
+
export type FocusOrigin = "keyboard" | "pointer" | "touch" | "program";
|
|
43
|
+
/** What `focusOrigin` returns. */
|
|
44
|
+
export interface FocusOriginMonitor {
|
|
45
|
+
/** The origin of the current focus, or null while nothing in the document has focus. */
|
|
46
|
+
readonly origin: ReadableSignal<FocusOrigin | null>;
|
|
47
|
+
/** Removes the listeners and the attribute. */
|
|
48
|
+
dispose(): void;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Watches how focus arrives, the way Angular CDK's focus monitor does: a key
|
|
52
|
+
* pressed before focus moves means keyboard, a pointer pressed means pointer
|
|
53
|
+
* or touch, anything else means program. The origin is a signal and a
|
|
54
|
+
* `data-focus-origin` attribute on the root element, so a stylesheet can
|
|
55
|
+
* show focus rings for keyboard users only: `[data-focus-origin="keyboard"] :focus { outline: ... }`.
|
|
56
|
+
*/
|
|
57
|
+
export declare function focusOrigin(doc?: Document): FocusOriginMonitor;
|
|
58
|
+
//# sourceMappingURL=focus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus.d.ts","sourceRoot":"","sources":["../src/focus.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,UAAU,CAAC;AAwBlE,mGAAmG;AACnG,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,WAAW,EAAE,CAGvD;AAKD,+BAA+B;AAC/B,MAAM,WAAW,gBAAgB;IAE7B,uKAAuK;IACvK,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,KAAK,CAAC;IACvC,2FAA2F;IAC3F,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CA8FpF;AAED,oCAAoC;AACpC,MAAM,WAAW,aAAa;IAE1B,uGAAuG;IACvG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mHAAmH;IACnH,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC;IACjD,wEAAwE;IACxE,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAID;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,aAAkB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CA6FtF;AAED,6CAA6C;AAC7C,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAEvE,kCAAkC;AAClC,MAAM,WAAW,kBAAkB;IAE/B,wFAAwF;IACxF,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACpD,+CAA+C;IAC/C,OAAO,IAAI,IAAI,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,GAAE,QAAmB,GAAG,kBAAkB,CA8CxE"}
|
package/dist/focus.js
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Focus management: the trap a dialog needs, the roving tabindex a composite
|
|
3
|
+
* widget needs, and a monitor that tells keyboard focus from pointer focus.
|
|
4
|
+
* The trap and the roving tabindex are `ref` callbacks, so they attach when
|
|
5
|
+
* the element is created and clean up when its template is removed.
|
|
6
|
+
*/
|
|
7
|
+
import { onDispose, signal } from "zerolith";
|
|
8
|
+
const FOCUSABLE = "a[href], area[href], button:not(:disabled), input:not(:disabled):not([type=hidden]), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"]):not(:disabled), [contenteditable=\"true\"], audio[controls], video[controls], details > summary, iframe";
|
|
9
|
+
/** True when an element is rendered, visible, and outside any `inert` subtree, so it can take focus. */
|
|
10
|
+
function reachable(element) {
|
|
11
|
+
return element.getClientRects().length > 0 && element.closest("[inert]") === null && (element.ownerDocument.defaultView ?? window).getComputedStyle(element).visibility === "visible";
|
|
12
|
+
}
|
|
13
|
+
/** True for a control that uses the arrow keys itself: a text field, a list box, or editable text. */
|
|
14
|
+
function editsText(target) {
|
|
15
|
+
if (!(target instanceof HTMLElement)) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if (target instanceof HTMLInputElement) {
|
|
19
|
+
return !["button", "checkbox", "color", "file", "hidden", "image", "radio", "range", "reset", "submit"].includes(target.type);
|
|
20
|
+
}
|
|
21
|
+
return target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement || target.isContentEditable;
|
|
22
|
+
}
|
|
23
|
+
/** The elements inside `root` that take Tab focus, in document order, skipping anything hidden. */
|
|
24
|
+
export function focusables(root) {
|
|
25
|
+
return [...root.querySelectorAll(FOCUSABLE)].filter(reachable);
|
|
26
|
+
}
|
|
27
|
+
/** The elements with an attached focus trap, newest last. Only the newest acts, so a dialog opened from another keeps focus, and removing it hands control back. */
|
|
28
|
+
const traps = [];
|
|
29
|
+
/**
|
|
30
|
+
* A `ref` that keeps Tab and Shift+Tab inside the element, pulls focus back
|
|
31
|
+
* when it lands outside, moves focus in once the element is in the document,
|
|
32
|
+
* and returns it where it came from when the element's template is removed.
|
|
33
|
+
* With traps on several elements, as when a dialog opens a confirmation,
|
|
34
|
+
* only the newest acts until its template is removed.
|
|
35
|
+
*/
|
|
36
|
+
export function focusTrap(options = {}) {
|
|
37
|
+
return (element) => {
|
|
38
|
+
const doc = element.ownerDocument;
|
|
39
|
+
const previous = doc.activeElement instanceof HTMLElement ? doc.activeElement : null;
|
|
40
|
+
const fallback = () => {
|
|
41
|
+
const first = focusables(element)[0];
|
|
42
|
+
if (first !== undefined) {
|
|
43
|
+
return first;
|
|
44
|
+
}
|
|
45
|
+
if (!element.hasAttribute("tabindex")) {
|
|
46
|
+
element.setAttribute("tabindex", "-1");
|
|
47
|
+
}
|
|
48
|
+
return element;
|
|
49
|
+
};
|
|
50
|
+
let disposed = false;
|
|
51
|
+
traps.push(element);
|
|
52
|
+
const initial = options.initial;
|
|
53
|
+
const focusInitial = () => {
|
|
54
|
+
if (disposed || !element.isConnected || initial === false) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const target = typeof initial === "string" ? element.querySelector(initial) ?? fallback() : initial ?? fallback();
|
|
58
|
+
target.focus();
|
|
59
|
+
};
|
|
60
|
+
if (initial !== false) {
|
|
61
|
+
if (element.isConnected) {
|
|
62
|
+
focusInitial();
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
queueMicrotask(focusInitial);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const onKeydown = (event) => {
|
|
69
|
+
const key = event;
|
|
70
|
+
if (key.key !== "Tab" || traps.at(-1) !== element) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const list = focusables(element);
|
|
74
|
+
const first = list[0];
|
|
75
|
+
const last = list.at(-1);
|
|
76
|
+
if (first === undefined || last === undefined) {
|
|
77
|
+
key.preventDefault();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const active = doc.activeElement;
|
|
81
|
+
if (key.shiftKey && (active === first || !element.contains(active))) {
|
|
82
|
+
key.preventDefault();
|
|
83
|
+
last.focus();
|
|
84
|
+
}
|
|
85
|
+
else if (!key.shiftKey && (active === last || !element.contains(active))) {
|
|
86
|
+
key.preventDefault();
|
|
87
|
+
first.focus();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const onFocusIn = (event) => {
|
|
91
|
+
if (traps.at(-1) === element && !element.contains(event.target)) {
|
|
92
|
+
fallback().focus();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
element.addEventListener("keydown", onKeydown);
|
|
96
|
+
doc.addEventListener("focusin", onFocusIn);
|
|
97
|
+
onDispose(() => {
|
|
98
|
+
disposed = true;
|
|
99
|
+
const index = traps.lastIndexOf(element);
|
|
100
|
+
if (index !== -1) {
|
|
101
|
+
traps.splice(index, 1);
|
|
102
|
+
}
|
|
103
|
+
element.removeEventListener("keydown", onKeydown);
|
|
104
|
+
doc.removeEventListener("focusin", onFocusIn);
|
|
105
|
+
if (options.restore !== false && previous !== null && previous.isConnected) {
|
|
106
|
+
previous.focus();
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
const ROVING_ITEMS = "[data-roving], [role=\"tab\"], [role=\"menuitem\"], [role=\"menuitemcheckbox\"], [role=\"menuitemradio\"], [role=\"option\"], [role=\"radio\"], [role=\"treeitem\"], [role=\"gridcell\"]";
|
|
112
|
+
/**
|
|
113
|
+
* A `ref` for a composite widget: exactly one item is in the Tab order, the
|
|
114
|
+
* arrow keys, Home, and End move between items, and the item that was
|
|
115
|
+
* selected or checked starts as the current one. Disabled, hidden, and
|
|
116
|
+
* inert items are skipped, as the children of a collapsed tree item are.
|
|
117
|
+
*/
|
|
118
|
+
export function rovingTabindex(options = {}) {
|
|
119
|
+
const selector = options.items ?? ROVING_ITEMS;
|
|
120
|
+
const orientation = options.orientation ?? "both";
|
|
121
|
+
const loop = options.loop !== false;
|
|
122
|
+
return (element) => {
|
|
123
|
+
const all = () => [...element.querySelectorAll(selector)];
|
|
124
|
+
const items = () => all().filter((item) => !item.hasAttribute("disabled") && item.getAttribute("aria-disabled") !== "true");
|
|
125
|
+
let current;
|
|
126
|
+
const apply = (next) => {
|
|
127
|
+
const list = items();
|
|
128
|
+
current = next !== undefined && list.includes(next) ? next : list.find((item) => item.getAttribute("aria-selected") === "true" || item.getAttribute("aria-checked") === "true") ?? list[0];
|
|
129
|
+
for (const item of all()) {
|
|
130
|
+
item.tabIndex = item === current ? 0 : -1;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const move = (step, edge) => {
|
|
134
|
+
const list = items().filter(reachable);
|
|
135
|
+
if (list.length === 0) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
let index = edge === "first" ? 0 : edge === "last" ? list.length - 1 : list.indexOf(current ?? list[0]) + step;
|
|
139
|
+
if (index < 0 || index >= list.length) {
|
|
140
|
+
if (!loop) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
index = (index + list.length) % list.length;
|
|
144
|
+
}
|
|
145
|
+
const target = list[index];
|
|
146
|
+
if (target !== undefined) {
|
|
147
|
+
apply(target);
|
|
148
|
+
target.focus();
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const onKeydown = (event) => {
|
|
152
|
+
const key = event;
|
|
153
|
+
if (editsText(key.target) && !items().includes(key.target)) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const horizontal = orientation !== "vertical";
|
|
157
|
+
const vertical = orientation !== "horizontal";
|
|
158
|
+
if ((key.key === "ArrowRight" && horizontal) || (key.key === "ArrowDown" && vertical)) {
|
|
159
|
+
move(1);
|
|
160
|
+
}
|
|
161
|
+
else if ((key.key === "ArrowLeft" && horizontal) || (key.key === "ArrowUp" && vertical)) {
|
|
162
|
+
move(-1);
|
|
163
|
+
}
|
|
164
|
+
else if (key.key === "Home") {
|
|
165
|
+
move(0, "first");
|
|
166
|
+
}
|
|
167
|
+
else if (key.key === "End") {
|
|
168
|
+
move(0, "last");
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
key.preventDefault();
|
|
174
|
+
};
|
|
175
|
+
const onFocusIn = (event) => {
|
|
176
|
+
const target = event.target.closest(selector);
|
|
177
|
+
if (target !== null && element.contains(target)) {
|
|
178
|
+
apply(target);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
apply(undefined);
|
|
182
|
+
const observer = new MutationObserver(() => apply(current));
|
|
183
|
+
observer.observe(element, { childList: true, subtree: true });
|
|
184
|
+
element.addEventListener("keydown", onKeydown);
|
|
185
|
+
element.addEventListener("focusin", onFocusIn);
|
|
186
|
+
onDispose(() => {
|
|
187
|
+
observer.disconnect();
|
|
188
|
+
element.removeEventListener("keydown", onKeydown);
|
|
189
|
+
element.removeEventListener("focusin", onFocusIn);
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Watches how focus arrives, the way Angular CDK's focus monitor does: a key
|
|
195
|
+
* pressed before focus moves means keyboard, a pointer pressed means pointer
|
|
196
|
+
* or touch, anything else means program. The origin is a signal and a
|
|
197
|
+
* `data-focus-origin` attribute on the root element, so a stylesheet can
|
|
198
|
+
* show focus rings for keyboard users only: `[data-focus-origin="keyboard"] :focus { outline: ... }`.
|
|
199
|
+
*/
|
|
200
|
+
export function focusOrigin(doc = document) {
|
|
201
|
+
const origin = signal(null);
|
|
202
|
+
let last;
|
|
203
|
+
let timer;
|
|
204
|
+
const remember = (value) => {
|
|
205
|
+
last = value;
|
|
206
|
+
clearTimeout(timer);
|
|
207
|
+
timer = setTimeout(() => {
|
|
208
|
+
last = undefined;
|
|
209
|
+
}, 650);
|
|
210
|
+
};
|
|
211
|
+
const onKeydown = () => remember("keyboard");
|
|
212
|
+
const onPointerdown = (event) => remember(event.pointerType === "touch" ? "touch" : "pointer");
|
|
213
|
+
const onFocusIn = () => {
|
|
214
|
+
const value = last ?? "program";
|
|
215
|
+
origin.set(value);
|
|
216
|
+
doc.documentElement.setAttribute("data-focus-origin", value);
|
|
217
|
+
};
|
|
218
|
+
const onFocusOut = (event) => {
|
|
219
|
+
if (event.relatedTarget === null) {
|
|
220
|
+
origin.set(null);
|
|
221
|
+
doc.documentElement.removeAttribute("data-focus-origin");
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
doc.addEventListener("keydown", onKeydown, true);
|
|
225
|
+
doc.addEventListener("pointerdown", onPointerdown, true);
|
|
226
|
+
doc.addEventListener("focusin", onFocusIn, true);
|
|
227
|
+
doc.addEventListener("focusout", onFocusOut, true);
|
|
228
|
+
return {
|
|
229
|
+
origin,
|
|
230
|
+
dispose() {
|
|
231
|
+
clearTimeout(timer);
|
|
232
|
+
doc.removeEventListener("keydown", onKeydown, true);
|
|
233
|
+
doc.removeEventListener("pointerdown", onPointerdown, true);
|
|
234
|
+
doc.removeEventListener("focusin", onFocusIn, true);
|
|
235
|
+
doc.removeEventListener("focusout", onFocusOut, true);
|
|
236
|
+
doc.documentElement.removeAttribute("data-focus-origin");
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=focus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus.js","sourceRoot":"","sources":["../src/focus.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAuB,SAAS,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElE,MAAM,SAAS,GAAG,gRAAgR,CAAC;AAEnS,wGAAwG;AACxG,SAAS,SAAS,CAAC,OAAgB;IAE/B,OAAO,OAAO,CAAC,cAAc,EAAE,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,WAAW,IAAI,MAAM,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,UAAU,KAAK,SAAS,CAAC;AAC1L,CAAC;AAED,sGAAsG;AACtG,SAAS,SAAS,CAAC,MAA0B;IAEzC,IAAI,CAAC,CAAC,MAAM,YAAY,WAAW,CAAC,EACpC,CAAC;QACG,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,IAAI,MAAM,YAAY,gBAAgB,EACtC,CAAC;QACG,OAAO,CAAC,CAA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