inclusive-elements 0.6.1 → 0.7.0-beta.1
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/CHANGELOG.md +7 -0
- package/README.md +22 -17
- package/dist/index.d.ts +230 -0
- package/dist/index.js +1524 -503
- package/package.json +20 -23
- package/src/accordion/README.md +6 -6
- package/src/alerts/README.md +16 -14
- package/src/combobox/README.md +133 -0
- package/src/dialog/README.md +15 -17
- package/src/disclosure/README.md +5 -5
- package/src/menu/README.md +19 -26
- package/src/popover/README.md +10 -10
- package/src/tabs/README.md +12 -12
- package/src/toolbar/README.md +8 -8
- package/src/tooltip/README.md +14 -14
- package/dist/types/alerts/alerts.d.ts +0 -30
- package/dist/types/index.d.ts +0 -6
- package/dist/types/menu/menu.d.ts +0 -42
- package/dist/types/tabs/tabs.d.ts +0 -24
- package/dist/types/toolbar/toolbar.d.ts +0 -11
- package/dist/types/tooltip/tooltip.d.ts +0 -36
- package/dist/types/utils.d.ts +0 -15
package/package.json
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inclusive-elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-beta.1",
|
|
4
4
|
"description": "Accessible, lightweight, unstyled implementations of UI patterns that still need runtime help.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"module": "dist/index.js",
|
|
7
|
-
"types": "dist/types/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./dist/types/index.d.ts",
|
|
11
|
-
"import": "./dist/index.js"
|
|
12
|
-
},
|
|
13
|
-
"./package.json": "./package.json"
|
|
14
|
-
},
|
|
15
5
|
"license": "MIT",
|
|
16
6
|
"repository": "tobyzerner/inclusive-elements",
|
|
17
7
|
"files": [
|
|
@@ -19,13 +9,24 @@
|
|
|
19
9
|
"CHANGELOG.md",
|
|
20
10
|
"src/*/README.md"
|
|
21
11
|
],
|
|
12
|
+
"type": "module",
|
|
22
13
|
"sideEffects": false,
|
|
14
|
+
"module": "dist/index.js",
|
|
15
|
+
"types": "dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
23
|
"scripts": {
|
|
24
|
-
"dev": "
|
|
25
|
-
"build": "
|
|
24
|
+
"dev": "vp dev",
|
|
25
|
+
"build": "vp pack",
|
|
26
|
+
"check": "vp check",
|
|
27
|
+
"format": "vp fmt",
|
|
26
28
|
"prepare": "pnpm build",
|
|
27
|
-
"test": "
|
|
28
|
-
"preview": "vite preview",
|
|
29
|
+
"test": "vp test run",
|
|
29
30
|
"release": "release-it"
|
|
30
31
|
},
|
|
31
32
|
"dependencies": {
|
|
@@ -35,12 +36,12 @@
|
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@release-it/conventional-changelog": "^5.1.1",
|
|
37
38
|
"jsdom": "^29.0.1",
|
|
38
|
-
"prettier": "^2.8.8",
|
|
39
39
|
"release-it": "^15.11.0",
|
|
40
40
|
"typescript": "^5.9.3",
|
|
41
|
-
"vite": "
|
|
42
|
-
"
|
|
41
|
+
"vite": "catalog:",
|
|
42
|
+
"vite-plus": "catalog:"
|
|
43
43
|
},
|
|
44
|
+
"packageManager": "pnpm@10.17.1+sha512.17c560fca4867ae9473a3899ad84a88334914f379be46d455cbf92e5cf4b39d34985d452d2583baf19967fa76cb5c17bc9e245529d0b98745721aa7200ecaf7a",
|
|
44
45
|
"release-it": {
|
|
45
46
|
"git": {
|
|
46
47
|
"commitMessage": "release: v${version}",
|
|
@@ -57,9 +58,5 @@
|
|
|
57
58
|
"header": "# Changelog"
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
|
-
}
|
|
61
|
-
"prettier": {
|
|
62
|
-
"singleQuote": true
|
|
63
|
-
},
|
|
64
|
-
"packageManager": "pnpm@10.17.1+sha512.17c560fca4867ae9473a3899ad84a88334914f379be46d455cbf92e5cf4b39d34985d452d2583baf19967fa76cb5c17bc9e245529d0b98745721aa7200ecaf7a"
|
|
61
|
+
}
|
|
65
62
|
}
|
package/src/accordion/README.md
CHANGED
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
|
|
23
23
|
## Platform Requirements
|
|
24
24
|
|
|
25
|
-
-
|
|
25
|
+
- Requires modern browser support for grouped `<details name>` behavior.
|
|
26
26
|
|
|
27
27
|
## Behavior
|
|
28
28
|
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
29
|
+
- Giving related `<details>` elements the same `name` makes them behave like an accordion, where opening one closes the others.
|
|
30
|
+
- The browser provides the disclosure semantics and keyboard interaction.
|
|
31
|
+
- This keeps the pattern lightweight and easy to style, without a custom wrapper element.
|
|
32
32
|
|
|
33
33
|
## Further Reading
|
|
34
34
|
|
|
35
|
-
-
|
|
36
|
-
-
|
|
35
|
+
- [MDN: `<details>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/details)
|
|
36
|
+
- [ARIA Authoring Practices Guide: Accordion Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/accordion/)
|
package/src/alerts/README.md
CHANGED
|
@@ -29,21 +29,21 @@ alerts.speak('Hello stranger!');
|
|
|
29
29
|
|
|
30
30
|
### Container
|
|
31
31
|
|
|
32
|
-
-
|
|
33
|
-
-
|
|
32
|
+
- `<ui-alerts>` is the container and timing manager for a stack of alert elements.
|
|
33
|
+
- Any alerts already present as children when the element connects are reprocessed in place so they are announced and animated.
|
|
34
34
|
|
|
35
35
|
### Announcement Semantics
|
|
36
36
|
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
37
|
+
- Each alert can be announced politely or assertively.
|
|
38
|
+
- `show(..., { politeness })` takes precedence. Otherwise, existing authored live-region semantics on the alert are preserved before falling back to the element default.
|
|
39
|
+
- Polite alerts use `role="status"` and `aria-live="polite"`.
|
|
40
|
+
- Assertive alerts use `role="alert"` and `aria-live="assertive"`.
|
|
41
41
|
|
|
42
42
|
### Timing And Replacement
|
|
43
43
|
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
44
|
+
- Alerts auto-dismiss after their configured duration.
|
|
45
|
+
- Hovering or focusing an alert clears its dismissal timer, and the full duration starts again when pointer or focus leaves the alert.
|
|
46
|
+
- Showing a new alert with an existing `key` dismisses the previous alert with that key before the new one is announced.
|
|
47
47
|
|
|
48
48
|
## API
|
|
49
49
|
|
|
@@ -90,9 +90,9 @@ alerts.speak(message, { politeness: 'polite' });
|
|
|
90
90
|
|
|
91
91
|
`ui-alerts` is unstyled. The supported animation hooks are:
|
|
92
92
|
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
93
|
+
- New alerts receive `enter-*` classes so CSS can animate them in.
|
|
94
|
+
- Dismissed alerts animate out using `leave-*` classes and are then removed.
|
|
95
|
+
- Existing alerts animate into their new positions using the `move` class.
|
|
96
96
|
|
|
97
97
|
```css
|
|
98
98
|
ui-alerts {
|
|
@@ -113,7 +113,9 @@ ui-alerts > * {
|
|
|
113
113
|
ui-alerts > .enter-active,
|
|
114
114
|
ui-alerts > .leave-active,
|
|
115
115
|
ui-alerts > .move {
|
|
116
|
-
transition:
|
|
116
|
+
transition:
|
|
117
|
+
opacity 0.2s ease,
|
|
118
|
+
transform 0.2s ease;
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
ui-alerts > .move {
|
|
@@ -130,4 +132,4 @@ ui-alerts > * {
|
|
|
130
132
|
|
|
131
133
|
## Further Reading
|
|
132
134
|
|
|
133
|
-
-
|
|
135
|
+
- [ARIA Authoring Practices Guide: Alert Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/alert/)
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Combobox
|
|
2
|
+
|
|
3
|
+
**An accessible, filterable combobox built on native form controls.**
|
|
4
|
+
|
|
5
|
+
`ui-combobox` upgrades native `<select>` and `<input list>` controls into
|
|
6
|
+
user-friendly, accessible comboboxes.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
```js
|
|
11
|
+
import { ComboboxElement } from 'inclusive-elements';
|
|
12
|
+
|
|
13
|
+
window.customElements.define('ui-combobox', ComboboxElement);
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Use a `<select>` when values must come from its options:
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<label for="country">Country</label>
|
|
20
|
+
<ui-combobox>
|
|
21
|
+
<select id="country" name="country">
|
|
22
|
+
<option value="">Choose a country</option>
|
|
23
|
+
<option value="au">Australia</option>
|
|
24
|
+
<option value="nz">New Zealand</option>
|
|
25
|
+
</select>
|
|
26
|
+
</ui-combobox>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Add `multiple` for a token-based multi-select:
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<label for="specialties">Specialties</label>
|
|
33
|
+
<ui-combobox>
|
|
34
|
+
<select id="specialties" name="specialties[]" multiple>
|
|
35
|
+
<option value="cardiology">Cardiology</option>
|
|
36
|
+
<option value="emergency">Emergency medicine</option>
|
|
37
|
+
<option value="paediatrics">Paediatrics</option>
|
|
38
|
+
</select>
|
|
39
|
+
</ui-combobox>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Use `<input list>` when arbitrary text is also valid:
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<label for="city">City</label>
|
|
46
|
+
<ui-combobox>
|
|
47
|
+
<input id="city" name="city" type="text" list="cities" />
|
|
48
|
+
<datalist id="cities">
|
|
49
|
+
<option value="Adelaide"></option>
|
|
50
|
+
<option value="Melbourne"></option>
|
|
51
|
+
<option value="Sydney"></option>
|
|
52
|
+
</datalist>
|
|
53
|
+
</ui-combobox>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Requirements
|
|
57
|
+
|
|
58
|
+
- The browser must support the Popover API. Unsupported browsers keep the
|
|
59
|
+
native control unchanged.
|
|
60
|
+
- Keep the label outside `ui-combobox` and associate it with the native control.
|
|
61
|
+
- `<input list>` supports the `text`, `search`, `email`, `url`, and `tel` input
|
|
62
|
+
types, except for multi-address `<input type="email" multiple>` controls,
|
|
63
|
+
which remain native.
|
|
64
|
+
|
|
65
|
+
## Behavior
|
|
66
|
+
|
|
67
|
+
For a select, the element inserts a filter input and listbox alongside the native
|
|
68
|
+
control, then hides the select. For an `<input list>`, it reuses the native input
|
|
69
|
+
and replaces its suggestions with a filterable listbox. `multiple` selects show
|
|
70
|
+
selected options as removable tokens.
|
|
71
|
+
|
|
72
|
+
The native control remains in the DOM and is kept in sync, so it continues to
|
|
73
|
+
work as expected for form submission, validation, reset, events, focus, and
|
|
74
|
+
disabled states.
|
|
75
|
+
|
|
76
|
+
- Focus or click opens the suggestions. A select's filter input is cleared
|
|
77
|
+
so all options are visible; a datalist input keeps its submitted text.
|
|
78
|
+
- Typing filters options by label or value.
|
|
79
|
+
- Arrow Up and Arrow Down move through enabled options. Enter chooses one and
|
|
80
|
+
Escape closes the suggestions.
|
|
81
|
+
- Choosing a single-select option closes the popup. Choosing a multi-select option
|
|
82
|
+
adds a token and leaves the popup open.
|
|
83
|
+
- Left and Right move between multi-select tokens. Backspace or Delete removes a
|
|
84
|
+
focused token.
|
|
85
|
+
- Tab leaves the combobox without changing its value. With the popup closed,
|
|
86
|
+
Enter retains the input's native behavior, including form submission.
|
|
87
|
+
|
|
88
|
+
## API
|
|
89
|
+
|
|
90
|
+
Call `refresh()` after changing the source control or its related label, form,
|
|
91
|
+
or datalist in a way that does not emit an event or update observed markup.
|
|
92
|
+
|
|
93
|
+
```js
|
|
94
|
+
const combobox = document.querySelector('ui-combobox');
|
|
95
|
+
|
|
96
|
+
input.setAttribute('list', 'regional-cities');
|
|
97
|
+
combobox.refresh();
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Styling
|
|
101
|
+
|
|
102
|
+
Use the ARIA roles to style the combobox, listbox, and options. The generated
|
|
103
|
+
light DOM exposes these stable styling hooks where no semantic equivalent
|
|
104
|
+
exists:
|
|
105
|
+
|
|
106
|
+
- `[data-combobox-control]`
|
|
107
|
+
- `[data-combobox-tokens]`, `[data-combobox-token]`, and
|
|
108
|
+
`[data-combobox-token-remove]`
|
|
109
|
+
- `[role="option"][data-placeholder]` for a single select's empty option
|
|
110
|
+
- `[role="option"][data-active]` for the active option
|
|
111
|
+
|
|
112
|
+
```css
|
|
113
|
+
ui-combobox [role='listbox'] {
|
|
114
|
+
position: fixed;
|
|
115
|
+
position-anchor: auto;
|
|
116
|
+
max-height: 16rem;
|
|
117
|
+
overflow: auto;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
ui-combobox [role='option'][data-active] {
|
|
121
|
+
outline: 2px solid currentColor;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
ui-combobox [role='option'][data-placeholder] {
|
|
125
|
+
color: GrayText;
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Further Reading
|
|
130
|
+
|
|
131
|
+
- [ARIA Authoring Practices Guide: Combobox Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/)
|
|
132
|
+
- [MDN: ARIA combobox role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/combobox_role)
|
|
133
|
+
- [MDN: `<datalist>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/datalist)
|
package/src/dialog/README.md
CHANGED
|
@@ -12,11 +12,9 @@
|
|
|
12
12
|
<button type="button" id="delete-trigger">Delete</button>
|
|
13
13
|
|
|
14
14
|
<script type="module">
|
|
15
|
-
document
|
|
16
|
-
.getElementById('delete-
|
|
17
|
-
|
|
18
|
-
document.getElementById('delete-dialog')?.showModal();
|
|
19
|
-
});
|
|
15
|
+
document.getElementById('delete-trigger')?.addEventListener('click', () => {
|
|
16
|
+
document.getElementById('delete-dialog')?.showModal();
|
|
17
|
+
});
|
|
20
18
|
</script>
|
|
21
19
|
```
|
|
22
20
|
|
|
@@ -34,24 +32,24 @@
|
|
|
34
32
|
|
|
35
33
|
## Platform Requirements
|
|
36
34
|
|
|
37
|
-
-
|
|
38
|
-
-
|
|
35
|
+
- Requires modern browser support for `<dialog>`.
|
|
36
|
+
- Declarative `command="show-modal"` and `commandfor` buttons are newer platform features. Use `showModal()` when you need the imperative fallback.
|
|
39
37
|
|
|
40
38
|
## Behavior
|
|
41
39
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
40
|
+
- `<dialog>` provides the modal container and top-layer behavior.
|
|
41
|
+
- Declarative `command="show-modal"` / `commandfor` buttons and imperative `showModal()` calls are both valid ways to open the dialog.
|
|
42
|
+
- The browser manages focus movement, Escape handling, and inert background behavior.
|
|
45
43
|
|
|
46
44
|
## Accessibility Notes
|
|
47
45
|
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
46
|
+
- Give the dialog an accessible name with visible text and `aria-labelledby`, or with `aria-label` when no visible title fits.
|
|
47
|
+
- Provide an obvious dismiss action inside the dialog, not just Escape or backdrop dismissal.
|
|
48
|
+
- Use `<form method="dialog">` or `close()` intentionally so the close behavior is explicit in your markup and scripts.
|
|
49
|
+
- Native modal dialogs usually restore focus appropriately when they close. Only manage focus yourself when the opener is gone or your workflow needs a different destination.
|
|
50
|
+
- This pattern is for modal tasks that need blocking attention. For non-modal surfaces, use a popover or another native pattern instead.
|
|
53
51
|
|
|
54
52
|
## Further Reading
|
|
55
53
|
|
|
56
|
-
-
|
|
57
|
-
-
|
|
54
|
+
- [MDN: `<dialog>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dialog)
|
|
55
|
+
- [ARIA Authoring Practices Guide: Dialog (Modal) Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/)
|
package/src/disclosure/README.md
CHANGED
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
|
|
16
16
|
## Behavior
|
|
17
17
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
18
|
+
- `<summary>` acts as the built-in control for toggling the disclosure.
|
|
19
|
+
- The browser manages the open state and accessibility semantics.
|
|
20
20
|
|
|
21
21
|
## Accessibility Notes
|
|
22
22
|
|
|
23
|
-
-
|
|
23
|
+
- Write summary text that clearly describes the hidden content, not generic labels such as "More" without context.
|
|
24
24
|
|
|
25
25
|
## Further Reading
|
|
26
26
|
|
|
27
|
-
-
|
|
28
|
-
-
|
|
27
|
+
- [MDN: `<details>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/details)
|
|
28
|
+
- [ARIA Authoring Practices Guide: Disclosure Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/)
|
package/src/menu/README.md
CHANGED
|
@@ -13,19 +13,12 @@ window.customElements.define('ui-menu', MenuElement);
|
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
```html
|
|
16
|
-
<button type="button" popovertarget="actions-menu" aria-haspopup="menu">
|
|
17
|
-
Actions
|
|
18
|
-
</button>
|
|
16
|
+
<button type="button" popovertarget="actions-menu" aria-haspopup="menu">Actions</button>
|
|
19
17
|
|
|
20
18
|
<ui-menu id="actions-menu" popover data-placement="bottom-start">
|
|
21
19
|
<button type="button" role="menuitem">Edit</button>
|
|
22
20
|
<button type="button" role="menuitem">Archive</button>
|
|
23
|
-
<button
|
|
24
|
-
type="button"
|
|
25
|
-
role="menuitem"
|
|
26
|
-
popovertarget="more-menu"
|
|
27
|
-
aria-haspopup="menu"
|
|
28
|
-
>
|
|
21
|
+
<button type="button" role="menuitem" popovertarget="more-menu" aria-haspopup="menu">
|
|
29
22
|
More
|
|
30
23
|
</button>
|
|
31
24
|
</ui-menu>
|
|
@@ -38,38 +31,38 @@ window.customElements.define('ui-menu', MenuElement);
|
|
|
38
31
|
|
|
39
32
|
## Platform Requirements
|
|
40
33
|
|
|
41
|
-
-
|
|
42
|
-
-
|
|
34
|
+
- Requires modern browser support for the Popover API.
|
|
35
|
+
- The styling examples use CSS anchor positioning.
|
|
43
36
|
|
|
44
37
|
## Behavior
|
|
45
38
|
|
|
46
39
|
### Structure
|
|
47
40
|
|
|
48
|
-
-
|
|
49
|
-
-
|
|
41
|
+
- Add `popover` to the root `<ui-menu>` and point a button at it with `popovertarget` and `aria-haspopup="menu"`.
|
|
42
|
+
- Give direct children a menu item role such as `role="menuitem"`. `ui-menu` adds `role="menu"` and `tabindex="-1"` to the menu itself and manages direct menuitem children with `tabindex="-1"` as well.
|
|
50
43
|
|
|
51
44
|
### Navigation
|
|
52
45
|
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
46
|
+
- By default, menus are vertical. Arrow Down and Arrow Up move through the enabled items and wrap at the ends.
|
|
47
|
+
- Pressing Arrow Down or Arrow Up on the root trigger opens the menu and focuses the first or last enabled item.
|
|
48
|
+
- Typeahead matches and moves focus to enabled items by their `aria-label` when present, otherwise by their text content.
|
|
56
49
|
|
|
57
50
|
### Horizontal Menus
|
|
58
51
|
|
|
59
|
-
-
|
|
60
|
-
-
|
|
52
|
+
- To make a horizontal popup menu, set `aria-orientation="horizontal"` on `<ui-menu>`. This keeps the element a `menu`, not a `menubar`, and works well for patterns such as reaction pickers.
|
|
53
|
+
- In a horizontal popup menu, Left and Right move through the enabled items and wrap at the ends.
|
|
61
54
|
|
|
62
55
|
### Submenus
|
|
63
56
|
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
57
|
+
- To create a submenu, make a menu item that points at another `<ui-menu>` with `popovertarget` and `aria-haspopup="menu"`.
|
|
58
|
+
- Submenus open on click, hover, Enter, or Space, Right Arrow in vertical menus, and Down Arrow in horizontal menus.
|
|
59
|
+
- Submenus close with Left Arrow in vertical menus and Up Arrow in horizontal menus.
|
|
67
60
|
|
|
68
61
|
### Closing
|
|
69
62
|
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
63
|
+
- Clicking a regular menu item closes the open menu tree.
|
|
64
|
+
- Escape also closes the open menu tree.
|
|
65
|
+
- Tab closes the open menu tree before normal tab order continues.
|
|
73
66
|
|
|
74
67
|
## API
|
|
75
68
|
|
|
@@ -99,5 +92,5 @@ MenuElement.searchDelay = 800;
|
|
|
99
92
|
|
|
100
93
|
## Further Reading
|
|
101
94
|
|
|
102
|
-
-
|
|
103
|
-
-
|
|
95
|
+
- [ARIA Authoring Practices Guide: Menu and Menubar Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/menubar/)
|
|
96
|
+
- [MDN: Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API/Using)
|
package/src/popover/README.md
CHANGED
|
@@ -14,20 +14,20 @@
|
|
|
14
14
|
|
|
15
15
|
## Platform Requirements
|
|
16
16
|
|
|
17
|
-
-
|
|
18
|
-
-
|
|
17
|
+
- Requires modern browser support for the Popover API.
|
|
18
|
+
- The styling examples use CSS anchor positioning.
|
|
19
19
|
|
|
20
20
|
## Behavior
|
|
21
21
|
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
22
|
+
- The button uses `popovertarget` to control the popover surface.
|
|
23
|
+
- The browser manages opening, closing, and light dismiss behavior for the popover.
|
|
24
|
+
- CSS anchor positioning can be used to place the popover relative to its trigger.
|
|
25
25
|
|
|
26
26
|
## Accessibility Notes
|
|
27
27
|
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
28
|
+
- `popover` gives you a surface and lifecycle, not a semantic role. Choose markup and ARIA that match the actual pattern, such as menu, tooltip, or generic descriptive content.
|
|
29
|
+
- Make sure the trigger has an accessible name and clearly communicates what will open.
|
|
30
|
+
- Keep the content structure appropriate to the job. A simple help popover can stay plain, while interactive or decision-heavy content may be better served by a dialog.
|
|
31
31
|
|
|
32
32
|
## Styling
|
|
33
33
|
|
|
@@ -90,5 +90,5 @@ As a simple recommendation, you can style all popover surfaces with the `popover
|
|
|
90
90
|
|
|
91
91
|
## Further Reading
|
|
92
92
|
|
|
93
|
-
-
|
|
94
|
-
-
|
|
93
|
+
- [MDN: Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API/Using)
|
|
94
|
+
- [MDN: CSS Anchor Positioning](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_anchor_positioning)
|
package/src/tabs/README.md
CHANGED
|
@@ -41,26 +41,26 @@ window.customElements.define('ui-tabs', TabsElement);
|
|
|
41
41
|
|
|
42
42
|
### Structure
|
|
43
43
|
|
|
44
|
-
-
|
|
45
|
-
-
|
|
44
|
+
- Add one descendant with `role="tablist"`. Use `button` elements with `role="tab"` inside it. Panels are read from owned descendants with `role="tabpanel"`, and `ui-tabs` pairs them strictly by document order.
|
|
45
|
+
- For initialized pairs, `ui-tabs` preserves existing `id` values where present, fills in missing `id` values, and normalizes `aria-controls` and `aria-labelledby` so each ordered pair stays wired together.
|
|
46
46
|
|
|
47
47
|
### Selection And Panels
|
|
48
48
|
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
49
|
+
- Set `aria-selected="true"` on the tab that should be active by default. If none is marked selected, the first tab is selected automatically when the element connects.
|
|
50
|
+
- The active tab gets `aria-selected="true"` and stays in the normal tab order. Inactive tabs get `aria-selected="false"` and `tabindex="-1"`.
|
|
51
|
+
- Only the active panel remains visible. Other panels get `hidden = true`.
|
|
52
|
+
- If the active panel has no tabbable content and no author-provided `tabindex`, `ui-tabs` gives the panel `tabindex="0"` so keyboard users can still reach it.
|
|
53
|
+
- The element dispatches a `change` event on the `<ui-tabs>` element when user interaction or `selectTab()` changes the active tab.
|
|
54
54
|
|
|
55
55
|
### Keyboard Navigation
|
|
56
56
|
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
57
|
+
- In a horizontal tablist, Left and Right move between tabs and wrap at the ends. Home and End jump to the first or last tab.
|
|
58
|
+
- In a vertical tablist, set `aria-orientation="vertical"` on the tablist. Then Up and Down move between tabs instead of Left and Right.
|
|
59
|
+
- Moving focus with the keyboard automatically activates the newly focused tab.
|
|
60
60
|
|
|
61
61
|
### Dynamic Changes
|
|
62
62
|
|
|
63
|
-
-
|
|
63
|
+
- Adding, removing, or re-roleing tabs and panels after connection automatically re-syncs the ordered pairs. The current selected tab is preserved when its ordered slot still has a matching panel.
|
|
64
64
|
|
|
65
65
|
## API
|
|
66
66
|
|
|
@@ -87,4 +87,4 @@ tabs.selectTab(index, {
|
|
|
87
87
|
|
|
88
88
|
## Further Reading
|
|
89
89
|
|
|
90
|
-
-
|
|
90
|
+
- [ARIA Authoring Practices Guide: Tabs Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/)
|
package/src/toolbar/README.md
CHANGED
|
@@ -30,22 +30,22 @@ window.customElements.define('ui-toolbar', ToolbarElement);
|
|
|
30
30
|
|
|
31
31
|
### Structure
|
|
32
32
|
|
|
33
|
-
-
|
|
33
|
+
- `ui-toolbar` adds `role="toolbar"` if it is not already present.
|
|
34
34
|
|
|
35
35
|
### Focus Management
|
|
36
36
|
|
|
37
|
-
-
|
|
38
|
-
-
|
|
37
|
+
- The toolbar itself starts as the entry point into the widget. When it receives focus, focus moves to the current managed control inside it.
|
|
38
|
+
- The active control gets `tabindex="0"`. Other controls get `tabindex="-1"` so Tab leaves the toolbar instead of stepping through every control.
|
|
39
39
|
|
|
40
40
|
### Keyboard Navigation
|
|
41
41
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
42
|
+
- By default, toolbars are horizontal. Left and Right move focus between controls and wrap at the ends.
|
|
43
|
+
- Set `aria-orientation="vertical"` when the toolbar is arranged vertically. Then Up and Down move focus between controls instead.
|
|
44
|
+
- Home and End move focus to the first or last control.
|
|
45
45
|
|
|
46
46
|
### Dynamic Changes
|
|
47
47
|
|
|
48
|
-
-
|
|
48
|
+
- Adding or removing controls after connection keeps the roving tabindex state in sync so the toolbar remains a single managed widget in the tab order.
|
|
49
49
|
|
|
50
50
|
## Styling
|
|
51
51
|
|
|
@@ -65,4 +65,4 @@ ui-toolbar[aria-orientation='vertical'] {
|
|
|
65
65
|
|
|
66
66
|
## Further Reading
|
|
67
67
|
|
|
68
|
-
-
|
|
68
|
+
- [ARIA Authoring Practices Guide: Toolbar Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/)
|
package/src/tooltip/README.md
CHANGED
|
@@ -26,32 +26,32 @@ window.customElements.define('ui-tooltip', TooltipElement);
|
|
|
26
26
|
|
|
27
27
|
## Platform Requirements
|
|
28
28
|
|
|
29
|
-
-
|
|
30
|
-
-
|
|
29
|
+
- Requires modern browser support for the Popover API and hint popovers with `popover="hint"`.
|
|
30
|
+
- The styling examples use CSS anchor positioning.
|
|
31
31
|
|
|
32
32
|
## Behavior
|
|
33
33
|
|
|
34
34
|
### Structure
|
|
35
35
|
|
|
36
|
-
-
|
|
37
|
-
-
|
|
36
|
+
- `ui-tooltip` adds `popover="hint"` and `role="tooltip"` if they are not already present.
|
|
37
|
+
- The tooltip ensures it has an `id` and adds that value to the owner's `aria-describedby`.
|
|
38
38
|
|
|
39
39
|
### Ownership
|
|
40
40
|
|
|
41
|
-
-
|
|
42
|
-
-
|
|
41
|
+
- Use whichever ownership style fits the markup best: if the tooltip has a `for` attribute, it targets the element with that `id`; otherwise, it targets its immediately preceding element sibling.
|
|
42
|
+
- Changing `for`, `id`, or `disabled` re-syncs the owner relationship automatically.
|
|
43
43
|
|
|
44
44
|
### Visibility And Interaction
|
|
45
45
|
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
46
|
+
- The `disabled` attribute, or the reflected `tooltip.disabled` property, prevents the tooltip from showing and clears any current owner relationship.
|
|
47
|
+
- Tooltips do not show while the tooltip itself is `disabled`, or when the resolved owner is `disabled` or `aria-disabled="true"`.
|
|
48
|
+
- The tooltip shows on keyboard focus and pointer hover, hides on blur, pointer exit, click, and Escape, and stays open while the pointer moves between the owner and the tooltip.
|
|
49
49
|
|
|
50
50
|
### Content Guidance
|
|
51
51
|
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
52
|
+
- Tooltip content should stay descriptive, supplemental, and non-interactive.
|
|
53
|
+
- Do not put required instructions or critical information in a tooltip, because hover is not reliably available on touch and other coarse-pointer devices.
|
|
54
|
+
- If you need buttons, links, form controls, or information the user must be able to discover, use a popover or dialog pattern instead.
|
|
55
55
|
|
|
56
56
|
## API
|
|
57
57
|
|
|
@@ -93,5 +93,5 @@ ui-tooltip[popover][data-placement='bottom'] {
|
|
|
93
93
|
|
|
94
94
|
## Further Reading
|
|
95
95
|
|
|
96
|
-
-
|
|
97
|
-
-
|
|
96
|
+
- [ARIA Authoring Practices Guide: Tooltip Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/)
|
|
97
|
+
- [MDN: Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API/Using)
|