@jonmilner/ui 0.2.3 → 0.2.4

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.
@@ -73,7 +73,7 @@ The labelled action: a `<button type="button">` with the house look, or a link s
73
73
  ## Accessibility
74
74
 
75
75
  - A button that goes somewhere is a link (`as="a"` with `href`); one that does something is a button.
76
- - Disabled and loading buttons stay in the tab order, so keyboard and screen reader users find them; Enter and Space do nothing while either is set.
76
+ - Disabled and loading buttons stay in the tab order, so keyboard and screen reader users find them; Enter and Space do nothing while either is set. The blocked click still bubbles to an ancestor's `onClick` (see Clickable's Rules).
77
77
  - State is never color alone: disabled adds a dashed border, loading shows the dots. Under forced colors the button keeps its system colors (`LinkText` fill for `primary` and `danger`, a `CanvasText` border for `secondary`) and a disabled one is `GrayText`. Hover draws no tint there, so the system pairs keep their contrast.
78
78
  - Under reduced motion the dots hold still.
79
79
  - Text on every variant passes 4.5:1 at rest and on hover in light and dark modes.
@@ -21,11 +21,26 @@ The low-level base for everything a user presses: a `<button type="button">` by
21
21
  - `busy` renders `aria-busy="true"` and blocks activation the same way. Pair it with a visible change (a spinner or new label).
22
22
  - Set state with `disabled` and `busy`, not `aria-disabled` and `aria-busy`. A raw attribute still blocks the click, since JSX cannot reject hyphenated attributes, but the props are the API.
23
23
  - `as="button"` gets `type="button"`; pass `type="submit"` for a form's submit button. A component passed as `as` gets no `type`; it sets its own.
24
- - Only `onClick` is blocked. Do not put actions in `onPointerDown`, `onMouseDown` or `onKeyDown`.
24
+ - Only `onClick` and `onAuxClick` are blocked. Do not put actions in `onPointerDown`, `onMouseDown` or `onKeyDown`.
25
25
  - Layout and the target size are default style props (`display="inline-flex"`, centered, `minInlineSize` and `minBlockSize` `"xs"`, 24px). Raise them freely; never set them below `"xs"`.
26
26
  - Style props win over the stripped chrome, so `padding`, `color` and `backgroundColor` apply as given.
27
27
  - The focus ring is the library's one ring (`outline` in the `focus` color, `Highlight` under forced colors). Do not restyle `:focus-visible` or `outline`.
28
28
  - A client component (`'use client'`): it wraps `onClick`. Server components can render it with serializable props.
29
+ - A blocked click still bubbles: Clickable never calls `stopPropagation`, so an ancestor's `onClick` and `onAuxClick` run, unlike a native disabled button, which fires no click. A row handler or analytics listener sees it. An ancestor that must not act on a disabled or busy child checks with `closest`, since the target can be a span inside the control:
30
+
31
+ ```tsx
32
+ // Clicking the disabled Delete still reaches the row; the check keeps `select` from running.
33
+ <li
34
+ onClick={(event) => {
35
+ if ((event.target as Element).closest('[aria-disabled="true"], [aria-busy="true"]')) return;
36
+ select();
37
+ }}
38
+ >
39
+ <Clickable disabled onClick={remove}>
40
+ Delete
41
+ </Clickable>
42
+ </li>
43
+ ```
29
44
 
30
45
  ## Do
31
46
 
@@ -62,7 +62,7 @@ A compact button whose only visible content is an icon, for an action the icon m
62
62
 
63
63
  - The `label` is announced as the button's name; the icon is hidden from assistive technology.
64
64
  - The label is not shown on hover or focus. Sighted users who don't recognise the icon get no text, so keep IconButton to widely understood icons.
65
- - A disabled IconButton stays in the tab order, and Enter and Space do nothing. State is never color alone: disabled adds a dashed border.
65
+ - A disabled IconButton stays in the tab order, and Enter and Space do nothing; the blocked click still bubbles to an ancestor's `onClick` (see Clickable's Rules). State is never color alone: disabled adds a dashed border.
66
66
  - Every size is at least 24 by 24 CSS px (WCAG 2.2 target size); the icon on each variant passes 4.5:1 at rest and on hover in light and dark modes. Under forced colors it keeps Button's system colors.
67
67
 
68
68
  ## Props
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "./manifest.schema.json",
3
3
  "package": "@jonmilner/ui",
4
- "version": "0.2.3",
4
+ "version": "0.2.4",
5
5
  "components": [
6
6
  {
7
7
  "name": "AlertDialog",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jonmilner/ui",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "files": [
5
5
  "dist",
6
6
  "THIRD_PARTY_NOTICES.md"