@jonmilner/ui 0.11.0 → 0.11.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/dist/Toast/client.mjs +3 -0
- package/dist/docs/Toast.md +2 -2
- package/dist/docs/manifest.json +1 -1
- package/package.json +1 -1
package/dist/Toast/client.mjs
CHANGED
|
@@ -82,6 +82,9 @@ function N({ regionLabel: n, className: r, style: i, children: a }) {
|
|
|
82
82
|
let t = e.relatedTarget;
|
|
83
83
|
t && !e.currentTarget.contains(t) && (o.current = t);
|
|
84
84
|
},
|
|
85
|
+
onKeyDown: (e) => {
|
|
86
|
+
e.key === "Escape" && e.stopPropagation();
|
|
87
|
+
},
|
|
85
88
|
ref: s,
|
|
86
89
|
render: /* @__PURE__ */ T(t, {
|
|
87
90
|
className: e(g, r),
|
package/dist/docs/Toast.md
CHANGED
|
@@ -86,11 +86,11 @@ toast.add({ title: "Update", description: releaseNotes });
|
|
|
86
86
|
- The stack is a `region` landmark named by `regionLabel` ("Notifications" by default); F6 moves focus to it, and Shift+Tab from there returns focus where it was. Each toast is a `group` named by its title. Neither the stack (`aria-live="off"`) nor the toasts are live regions; the provider renders two visually hidden ones that exist before any toast, and adds each toast's title and description to one as it arrives: `info` and `success` to a polite `status`, `error` to an assertive `alert`. So each toast is announced once, and an error at once (ADR 0074). Adding a toast never moves focus.
|
|
87
87
|
- A toast hidden by `limit` was announced when it arrived. When a newer one leaves and it shows again, it is not announced a second time; a user who needs it finds it in the stack with F6.
|
|
88
88
|
- An error raised from inside a modal `Dialog` is still announced: the dialog hides the rest of the page from assistive tech, but not the announcer's regions.
|
|
89
|
-
- Inside a modal `Dialog`: F6 still reaches the stack past the dialog's focus trap, so an error's action and close button stay in keyboard reach; Tab past the last toast returns focus to the dialog. Escape in the stack
|
|
89
|
+
- Inside a modal `Dialog`: F6 still reaches the stack past the dialog's focus trap, so an error's action and close button stay in keyboard reach; Tab past the last toast returns focus to the dialog. Escape on a toast closes only the toast; the dialog, and what was typed in it, stays (ADR 0132). Escape anywhere in the stack goes no further, so on the stack itself it does nothing, and an app's own `document` or `window` Escape listener never sees it.
|
|
90
90
|
- Reflow (WCAG 1.4.10): a stack taller than the window, as at 320px wide with 200% text, scrolls inside itself with the newest toast on top, so the older ones stay in reach.
|
|
91
91
|
- Resize text (WCAG 1.4.4): when the stack is narrower than 16rem, as at 320px wide with 200% text, the content moves to its own line below the icon and close button, so the button stays inside the card and words wrap whole (ADR 0067).
|
|
92
92
|
- Timing (WCAG 2.2.1, Timing Adjustable): a toast closes on its own only when it is not essential. The timer pauses while the pointer is over the stack, while keyboard focus is in it, and while the window is in the background, so a user who reaches it gets the time they need. An error stays until dismissed by default, and `duration: 0` keeps any toast. The close button dismisses a toast at any time.
|
|
93
|
-
- Dismissing a toast from the keyboard (Enter or Space on its close button, or a screen reader's activation) moves focus to the close button of the toast that takes its place: the next one, else the previous one. Dismissing the last returns focus to where it was before Tab or F6 brought it into the stack, so focus never falls to the page (ADR 0085).
|
|
93
|
+
- Dismissing a toast from the keyboard (Enter or Space on its close button, or a screen reader's activation) moves focus to the close button of the toast that takes its place: the next one, else the previous one. Dismissing the last returns focus to where it was before Tab or F6 brought it into the stack, so focus never falls to the page (ADR 0085). A click or swipe that leaves focus in the leaving toast also returns it there, without scrolling.
|
|
94
94
|
- The close button and the action are native buttons with the shared focus ring and a 24px target. The close button's name is `closeLabel`.
|
|
95
95
|
- Swiping a toast away, down or toward the stack's inline end (right, or left under `dir="rtl"`), is a shortcut; the close button does the same.
|
|
96
96
|
- Under reduced motion a toast only fades. Under forced colors it keeps its border.
|
package/dist/docs/manifest.json
CHANGED