@funstack/ui 0.1.0-alpha.16 → 0.1.0-alpha.17

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.
Files changed (143) hide show
  1. package/dist/accordion/accordion-root.mjs +1 -1
  2. package/dist/accordion/accordion-root.mjs.map +1 -1
  3. package/dist/button/button.d.mts +21 -8
  4. package/dist/button/button.d.mts.map +1 -1
  5. package/dist/button/button.mjs +8 -6
  6. package/dist/button/button.mjs.map +1 -1
  7. package/dist/checkbox-group/checkbox-group-root.mjs +5 -1
  8. package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -1
  9. package/dist/combobox/combobox-popup.d.mts +4 -1
  10. package/dist/combobox/combobox-popup.d.mts.map +1 -1
  11. package/dist/combobox/combobox-popup.mjs.map +1 -1
  12. package/dist/combobox/combobox-root.d.mts +15 -5
  13. package/dist/combobox/combobox-root.d.mts.map +1 -1
  14. package/dist/combobox/combobox-root.mjs +9 -11
  15. package/dist/combobox/combobox-root.mjs.map +1 -1
  16. package/dist/combobox/combobox-trigger.mjs +7 -2
  17. package/dist/combobox/combobox-trigger.mjs.map +1 -1
  18. package/dist/dialog/dialog-close.d.mts +13 -3
  19. package/dist/dialog/dialog-close.d.mts.map +1 -1
  20. package/dist/dialog/dialog-close.mjs +3 -2
  21. package/dist/dialog/dialog-close.mjs.map +1 -1
  22. package/dist/dialog/dialog-context.mjs.map +1 -1
  23. package/dist/dialog/dialog-form.d.mts +2 -1
  24. package/dist/dialog/dialog-form.d.mts.map +1 -1
  25. package/dist/dialog/dialog-form.mjs.map +1 -1
  26. package/dist/dialog/dialog-popup.d.mts +9 -4
  27. package/dist/dialog/dialog-popup.d.mts.map +1 -1
  28. package/dist/dialog/dialog-popup.mjs +12 -20
  29. package/dist/dialog/dialog-popup.mjs.map +1 -1
  30. package/dist/dialog/dialog-root.d.mts +38 -24
  31. package/dist/dialog/dialog-root.d.mts.map +1 -1
  32. package/dist/dialog/dialog-root.mjs +10 -8
  33. package/dist/dialog/dialog-root.mjs.map +1 -1
  34. package/dist/dialog/dialog-trigger.d.mts +3 -3
  35. package/dist/dialog/dialog-trigger.mjs.map +1 -1
  36. package/dist/dialog/index.d.mts +5 -5
  37. package/dist/dialog/index.mjs +5 -5
  38. package/dist/dialog/index.mjs.map +1 -1
  39. package/dist/docs/components/button.md +65 -21
  40. package/dist/docs/components/checkbox-group.md +12 -3
  41. package/dist/docs/components/combobox.md +85 -22
  42. package/dist/docs/components/context-menu.md +8 -8
  43. package/dist/docs/components/dialog.md +42 -36
  44. package/dist/docs/components/menu.md +106 -25
  45. package/dist/docs/components/popover.md +101 -36
  46. package/dist/docs/components/progress.md +1 -1
  47. package/dist/docs/components/slider.md +1 -1
  48. package/dist/docs/components/toast.md +37 -14
  49. package/dist/docs/components/toolbar.md +2 -1
  50. package/dist/docs/components/tooltip.md +1 -1
  51. package/dist/docs/concepts/action-props.md +55 -25
  52. package/dist/docs/concepts/browser-owned-state.md +27 -12
  53. package/dist/docs/concepts/pending-and-optimistic.md +15 -2
  54. package/dist/docs/concepts/render.md +23 -0
  55. package/dist/docs/concepts/server-components.md +15 -1
  56. package/dist/docs/concepts/suspense.md +8 -3
  57. package/dist/docs/concepts/transitions.md +3 -9
  58. package/dist/docs/getting-started.md +9 -22
  59. package/dist/docs/index.md +5 -4
  60. package/dist/docs/roadmap.md +54 -0
  61. package/dist/docs/why.md +7 -3
  62. package/dist/index.d.mts +2 -2
  63. package/dist/internal/call-urgent-handler.mjs +37 -0
  64. package/dist/internal/call-urgent-handler.mjs.map +1 -0
  65. package/dist/internal/css-transition-cut.mjs +66 -0
  66. package/dist/internal/css-transition-cut.mjs.map +1 -0
  67. package/dist/internal/overlay-popup.mjs.map +1 -1
  68. package/dist/internal/report-dropped.mjs +45 -0
  69. package/dist/internal/report-dropped.mjs.map +1 -0
  70. package/dist/internal/types.d.mts +33 -7
  71. package/dist/internal/types.d.mts.map +1 -1
  72. package/dist/internal/use-action-trigger.mjs +32 -17
  73. package/dist/internal/use-action-trigger.mjs.map +1 -1
  74. package/dist/internal/use-controllable-action.mjs +52 -16
  75. package/dist/internal/use-controllable-action.mjs.map +1 -1
  76. package/dist/internal/use-exit-animation.mjs +1 -1
  77. package/dist/internal/use-exit-animation.mjs.map +1 -1
  78. package/dist/internal/use-native-group-reconciliation.mjs +4 -2
  79. package/dist/internal/use-native-group-reconciliation.mjs.map +1 -1
  80. package/dist/internal/use-overlay-close.mjs +10 -4
  81. package/dist/internal/use-overlay-close.mjs.map +1 -1
  82. package/dist/internal/use-overlay-root.mjs +40 -7
  83. package/dist/internal/use-overlay-root.mjs.map +1 -1
  84. package/dist/internal/use-popover-popup.mjs +22 -7
  85. package/dist/internal/use-popover-popup.mjs.map +1 -1
  86. package/dist/internal/use-popover-trigger.d.mts +1 -1
  87. package/dist/internal/use-popover-trigger.d.mts.map +1 -1
  88. package/dist/internal/use-popover-trigger.mjs +11 -3
  89. package/dist/internal/use-popover-trigger.mjs.map +1 -1
  90. package/dist/menu/menu-checkbox-item.d.mts +1 -1
  91. package/dist/menu/menu-checkbox-item.mjs.map +1 -1
  92. package/dist/menu/menu-item.d.mts +15 -4
  93. package/dist/menu/menu-item.d.mts.map +1 -1
  94. package/dist/menu/menu-item.mjs +10 -5
  95. package/dist/menu/menu-item.mjs.map +1 -1
  96. package/dist/menu/menu-outside.mjs +2 -2
  97. package/dist/menu/menu-outside.mjs.map +1 -1
  98. package/dist/menu/menu-popup.d.mts +3 -0
  99. package/dist/menu/menu-popup.d.mts.map +1 -1
  100. package/dist/menu/menu-popup.mjs.map +1 -1
  101. package/dist/menu/menu-root.d.mts +27 -12
  102. package/dist/menu/menu-root.d.mts.map +1 -1
  103. package/dist/menu/menu-root.mjs +5 -4
  104. package/dist/menu/menu-root.mjs.map +1 -1
  105. package/dist/number-field/number-field-root.d.mts.map +1 -1
  106. package/dist/number-field/number-field-root.mjs +2 -8
  107. package/dist/number-field/number-field-root.mjs.map +1 -1
  108. package/dist/popover/index.d.mts +3 -3
  109. package/dist/popover/index.mjs +3 -3
  110. package/dist/popover/index.mjs.map +1 -1
  111. package/dist/popover/popover-close.d.mts +14 -3
  112. package/dist/popover/popover-close.d.mts.map +1 -1
  113. package/dist/popover/popover-close.mjs +4 -2
  114. package/dist/popover/popover-close.mjs.map +1 -1
  115. package/dist/popover/popover-popup.d.mts +6 -3
  116. package/dist/popover/popover-popup.d.mts.map +1 -1
  117. package/dist/popover/popover-popup.mjs +3 -2
  118. package/dist/popover/popover-popup.mjs.map +1 -1
  119. package/dist/popover/popover-root.d.mts +31 -18
  120. package/dist/popover/popover-root.d.mts.map +1 -1
  121. package/dist/popover/popover-root.mjs +9 -7
  122. package/dist/popover/popover-root.mjs.map +1 -1
  123. package/dist/slider/slider-root.d.mts.map +1 -1
  124. package/dist/slider/slider-root.mjs +2 -8
  125. package/dist/slider/slider-root.mjs.map +1 -1
  126. package/dist/toast/toast-action.d.mts +14 -3
  127. package/dist/toast/toast-action.d.mts.map +1 -1
  128. package/dist/toast/toast-action.mjs +6 -4
  129. package/dist/toast/toast-action.mjs.map +1 -1
  130. package/dist/toast/toast-context.mjs.map +1 -1
  131. package/dist/toast/toast-queue.mjs.map +1 -1
  132. package/dist/toast/toast-viewport.d.mts.map +1 -1
  133. package/dist/toast/toast-viewport.mjs +15 -15
  134. package/dist/toast/toast-viewport.mjs.map +1 -1
  135. package/dist/toast/toast.d.mts +10 -7
  136. package/dist/toast/toast.d.mts.map +1 -1
  137. package/dist/toast/toast.mjs.map +1 -1
  138. package/dist/toggle-group/toggle-group-root.mjs +1 -1
  139. package/dist/toggle-group/toggle-group-root.mjs.map +1 -1
  140. package/package.json +1 -1
  141. package/skills/funstack-ui-knowledge/SKILL.md +6 -6
  142. package/dist/internal/use-superseded-rejection.mjs +0 -47
  143. package/dist/internal/use-superseded-rejection.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  # Button
2
2
 
3
- A button whose click is a transition. Compared with `<button onClick>`, a `Button` runs `action` in its own transition and shows `data-pending` until it settles, ignores a second click while it is pending, sends a rejection to the nearest Error Boundary, and takes a Server Function as `action` or `formAction`.
3
+ A button whose click is a transition. Compared with `<button onClick>`, a `Button` runs `action` in its own transition and shows `data-pending` until it settles, runs or ignores a click that comes while it is pending (`whilePending`), sends a rejection to the nearest Error Boundary, and takes a Server Function as `action` or `formAction`.
4
4
 
5
5
  ```tsx title="ButtonSave.tsx"
6
6
  "use client";
@@ -11,9 +11,9 @@ import { DemoErrorBoundary } from "./DemoErrorBoundary.js";
11
11
  import { fakeSave } from "./fake-api.js";
12
12
 
13
13
  // Three Buttons with a 1.2 s fake save. Click Save several times quickly: the action runs once
14
- // (the call counter, optimistic so it counts at once), because a Button ignores activation while
15
- // its own action is pending. The
16
- // second Button rejects into the Error Boundary; the third catches inside and shows a toast.
14
+ // (the call counter, optimistic so it counts at once), because whilePending="ignore" makes the
15
+ // Button ignore activation while its own action is pending. The second Button rejects into the
16
+ // Error Boundary; the third catches inside and shows a toast.
17
17
  export function ButtonSave() {
18
18
  const [calls, setCalls] = useState(0);
19
19
  const [saved, setSaved] = useState(0);
@@ -24,6 +24,7 @@ export function ButtonSave() {
24
24
  <div className="demo-row">
25
25
  <Button
26
26
  className="demo-btn"
27
+ whilePending="ignore"
27
28
  action={async () => {
28
29
  addCall(undefined);
29
30
  setCalls((c) => c + 1);
@@ -73,8 +74,8 @@ export function ButtonSave() {
73
74
 
74
75
  ```css title="button.css"
75
76
  /* Button: [data-pending] is the in-flight state, [data-disabled] the consumer's `disabled`. A
76
- pending Button is also aria-disabled="true", so style "unavailable" from [data-disabled] (or
77
- aria-disabled without data-pending), not from aria-disabled alone. */
77
+ pending Button with whilePending="ignore" is also aria-disabled="true", so style "unavailable"
78
+ from [data-disabled] (or aria-disabled without data-pending), not from aria-disabled alone. */
78
79
  .demo-btn {
79
80
  display: inline-flex;
80
81
  align-items: center;
@@ -148,7 +149,40 @@ export function ButtonSave() {
148
149
  }
149
150
  ```
150
151
 
151
- Click Save several times quickly: the action runs once. While it runs the button carries `data-pending` and `aria-disabled="true"` and keeps focus. The second button rejects into an Error Boundary; the third catches the error inside its action, which the library counts as success, and reports it with a toast.
152
+ Click Save several times quickly: the action runs once, because Save has `whilePending="ignore"`. While it runs the button carries `data-pending` and `aria-disabled="true"` and keeps focus. The second button rejects into an Error Boundary; the third catches the error inside its action, which the library counts as success, and reports it with a toast.
153
+
154
+ ```tsx title="ButtonCounter.tsx"
155
+ "use client";
156
+ import { startTransition, useState } from "react";
157
+ import { Button } from "@funstack/ui/button";
158
+ import { fakeSave } from "./fake-api.js";
159
+
160
+ // A "+1" Button with the default whilePending="run": every click runs the action, also while an
161
+ // earlier one is still pending. The Button shows data-pending until the last run has settled and
162
+ // is never aria-disabled meanwhile. Each run awaits a 1 s fake request, then counts.
163
+ export function ButtonCounter() {
164
+ const [count, setCount] = useState(0);
165
+
166
+ return (
167
+ <div className="demo-row">
168
+ <Button
169
+ className="demo-btn"
170
+ action={async () => {
171
+ await fakeSave("the increment", { ms: 1000 });
172
+ startTransition(() => setCount((c) => c + 1));
173
+ }}
174
+ >
175
+ +1
176
+ </Button>
177
+ <output className="demo-readout">Count: {count}</output>
178
+ </div>
179
+ );
180
+ }
181
+ ```
182
+
183
+ `button.css`: the same file as above.
184
+
185
+ Without the prop every click runs: click +1 several times quickly and each click counts. The button shows `data-pending` until the last run has settled and is never `aria-disabled` meanwhile, since it still acts. React commits the runs' updates together once they have all finished. Holding Enter on a focused button repeats the click, as it does on any native button, and each repeat is a run.
152
186
 
153
187
  ## Anatomy
154
188
 
@@ -164,8 +198,9 @@ One element, no parts. It renders `<button type="button">`; `render` substitutes
164
198
 
165
199
  | Prop | Type | Default | Description |
166
200
  | - | - | - | - |
167
- | `action` | `Action<[details: ButtonActionDetails]>` | – | Runs inside the Button's own transition on click, Enter or Space. Sync or async; may be a Server Function (`details` carries only the virtual `event`). A rejection reaches the nearest Error Boundary above the Button. While it is pending, further activation is ignored and the Button is `aria-disabled="true"`. Not combinable with `formAction` (development error). |
168
- | `formAction` | `string \| ((formData: FormData) => void \| Promise<void>)` | – | React's `formAction`: run by React instead of the form's `action` when this Button submits the form. With a function the Button is pending for its own submissions only, ignores further activation meanwhile, and defaults to `type="submit"`. Prefer a stable function (a Server Function, a `useActionState` dispatch, `useCallback`) when the form is also submitted from script with `requestSubmit(button)`; an inline function works for clicks and Enter. The match is by function identity (React reports no submitter), so Buttons that share one function (one dispatch, different `name` / `value`) all show pending while either submits; give each its own function (`dispatch.bind(null, "draft")`) to tell them apart. |
201
+ | `action` | `Action<[details: ButtonActionDetails]>` | – | Runs inside the Button's own transition on click, Enter or Space. Sync or async; may be a Server Function (`details` carries only the virtual `event`). A rejection reaches the nearest Error Boundary above the Button. A click while it is pending runs it again, unless `whilePending` is `"ignore"`. Not combinable with `formAction` (development error). |
202
+ | `formAction` | `string \| ((formData: FormData) => void \| Promise<void>)` | – | React's `formAction`: run by React instead of the form's `action` when this Button submits the form. With a function the Button is pending for its own submissions only and defaults to `type="submit"`; a click meanwhile submits again unless `whilePending` is `"ignore"` (see [Forms](#forms)). Prefer a stable function (a Server Function, a `useActionState` dispatch, `useCallback`) when the form is also submitted from script with `requestSubmit(button)`; an inline function works for clicks and Enter. The match is by function identity (React reports no submitter), so Buttons that share one function (one dispatch, different `name` / `value`) all show pending while either submits; give each its own function (`dispatch.bind(null, "draft")`) to tell them apart. |
203
+ | `whilePending` | `"run" \| "ignore"` | `"run"` | What a click, Enter or Space does while this Button's own `action` (or its own function `formAction` submission) is pending. `"run"`: it runs as well; the Button shows `data-pending` until every run has settled. `"ignore"`: it starts nothing, its default action is cancelled (no second submission, navigation or command), and the Button is `aria-disabled="true"` while pending. Use `"ignore"` for an action that must not run twice (Save, Pay, Delete). No effect on a Button with neither `action` nor a function `formAction`. Type `WhilePending`. |
169
204
  | `type` | `"button" \| "submit" \| "reset"` | `"button", or "submit" with formAction` | Owned on a `<button>` and on a component `render` element (assumed to render a `<button>`; it should spread the prop): set it here, not on the element. Omitted for a host element of another tag (`<a>`). `action` together with `submit` / `reset` warns in development (one click would do two things). |
170
205
  | `disabled` | `boolean` | `false` | Native `disabled` and `data-disabled`; never dispatches, and a disabled link does not navigate. With `focusableWhenDisabled`, inside a [Toolbar](toolbar.md), or when `render` is not a `<button>` (a link, where native `disabled` means nothing), renders `aria-disabled="true"` instead. |
171
206
  | `focusableWhenDisabled` | `boolean` | `false (true inside a Toolbar.Root)` | Keep a disabled Button focusable: `aria-disabled="true"` instead of native `disabled`, so keyboard and screen-reader users still find it and a Tooltip on it still opens. |
@@ -186,7 +221,7 @@ Every other `<button>` prop passes through, including `name`, `value`, `form`, `
186
221
  | - | - |
187
222
  | `data-pending` | The Button's own `action` is in flight (until the commit that ends it, including a Suspense wait), or a submission it started with its own function `formAction` is pending. |
188
223
  | `data-disabled` | The `disabled` prop. Not set by pending. |
189
- | `aria-disabled` | `"true"` while pending, and while `disabled` with `focusableWhenDisabled`, inside a Toolbar, or on a non-`<button>` `render` element. |
224
+ | `aria-disabled` | `"true"` while pending with `whilePending="ignore"`, and while `disabled` with `focusableWhenDisabled`, inside a Toolbar, or on a non-`<button>` `render` element. Never set by pending in the default `"run"` mode. |
190
225
 
191
226
  Pending is not disabled: `[data-disabled]` and `state.disabled` are your `disabled` only, so the two states never have to look alike.
192
227
 
@@ -194,7 +229,7 @@ Pending is not disabled: `[data-disabled]` and `state.disabled` are your `disabl
194
229
 
195
230
  | Key | Native \<button> | render={\<a href>} |
196
231
  | - | - | - |
197
- | Enter | Click: runs `action` (unless pending or disabled) | Click: `action` and navigation; while pending, neither |
232
+ | Enter | Click: runs `action` (unless disabled, or pending with `whilePending="ignore"`) | Click: `action` and navigation; while pending with `whilePending="ignore"`, neither |
198
233
  | Space | Click on keyup: runs `action` | Nothing (a link); add `role="button"` and a key handler if a link must act on Space |
199
234
  | Tab | Sequential, or the Toolbar's single Tab stop inside one | Same |
200
235
 
@@ -210,15 +245,17 @@ None: the Button adds no transition types. Its `transition` prop animates the co
210
245
 
211
246
  Concept: [Pending & optimistic state](../concepts/pending-and-optimistic.md)
212
247
 
213
- A [pure trigger](../concepts/pending-and-optimistic.md#pure-trigger): no optimistic state. `data-pending` and `aria-disabled="true"` while its own action (or a submission started by its own function `formAction`) is in flight; a second click, Enter or Space is ignored meanwhile.
248
+ A [pure trigger](../concepts/pending-and-optimistic.md#pure-trigger): no optimistic state. `data-pending` while its own action (or a submission started by its own function `formAction`) is in flight. A second click, Enter or Space meanwhile runs again by default; with `whilePending="ignore"` it is ignored and the Button is `aria-disabled="true"`.
214
249
 
215
- ### Re-entry while pending
250
+ ### A click while pending
216
251
 
217
- While the Button's own action is in flight, a click, Enter or Space (also a programmatic `click()` and the click an implicit form submission sends) starts no second run and is `preventDefault()`ed, so a link does not navigate again, a form does not submit again and a `command` does not run again. Nothing else is blocked: focus, hover and your own event handlers work as usual, and ancestors still see the click.
252
+ A Button's action is yours alone, so by default (`whilePending="run"`) the Button does what React's `useTransition` does: every click, Enter or Space runs the action, also while an earlier run is pending. The runs overlap; the Button shows `data-pending` until the last has settled and is not `aria-disabled`, because it still acts. When runs overlap, the latest run's rejection reaches the Error Boundary and an older run's goes to `reportError` (see [Overlapping actions](../concepts/action-props.md#overlapping-actions)). A double click on a default Save therefore saves twice: give it `whilePending="ignore"`.
218
253
 
219
- - The Button is `aria-disabled="true"` meanwhile, so a screen-reader user who presses again, or comes back to it, hears that it is unavailable. It is never natively `disabled`: Chromium and Firefox move focus to the page when a focused button becomes disabled.
254
+ With `whilePending="ignore"`, a click, Enter or Space while the Button's own action is in flight (also a programmatic `click()` and the click an implicit form submission sends) starts no second run and is `preventDefault()`ed, so a link does not navigate again, a form does not submit again and a `command` does not run again. Nothing else is blocked: focus, hover and your own event handlers work as usual, and ancestors still see the click.
255
+
256
+ - The ignoring Button is `aria-disabled="true"` meanwhile, so a screen-reader user who presses again, or comes back to it, hears that it is unavailable. It is never natively `disabled`: Chromium and Firefox move focus to the page when a focused button becomes disabled.
220
257
  - The guard is the Button's own run, not its look. React may hold the commit that ends the action while another async action elsewhere is pending (or while the result suspends): the button keeps `data-pending` and `aria-disabled` in that window, but its own work has settled, so a click there starts a new run rather than being dropped. A `formAction` Button follows React's form status instead and stays guarded until its submission commits.
221
- - Want every click to count (a "+1" button)? Do not await the work: `action={() => { void increment(); }}`. The run is over a moment after the click, so every click runs the action, even while an unrelated action elsewhere holds the Button's commit (then only the pending look lingers until that commit lands). An ordered sequence whose steps see each other's results is `useActionState` (pass its dispatch as `formAction`, or call it from the action).
258
+ - An ordered sequence whose steps see each other's results is `useActionState` (pass its dispatch as `formAction`, or call it from the action).
222
259
 
223
260
  ## Suspense
224
261
 
@@ -311,7 +348,8 @@ import { fakeSave } from "./fake-api.js";
311
348
 
312
349
  // One form, three submitters. Form.Submit runs the form's own action and is pending for every
313
350
  // submission of the form (the form channel). Each Button formAction runs its own function instead
314
- // and is pending for its own submissions only; a second click on a pending one is ignored.
351
+ // and is pending for its own submissions only; with whilePending="ignore" a second click on a
352
+ // pending one is ignored (by default it would submit again).
315
353
  export function ButtonFormActions() {
316
354
  const [log, setLog] = useState<string[]>([]);
317
355
  const record = (line: string) => startTransition(() => setLog((l) => [line, ...l].slice(0, 4)));
@@ -334,6 +372,7 @@ export function ButtonFormActions() {
334
372
  </Form.Submit>
335
373
  <Button
336
374
  className="demo-btn"
375
+ whilePending="ignore"
337
376
  formAction={async (data: FormData) => {
338
377
  await fakeSave("the draft", { ms: 1500 });
339
378
  record(`Saved a draft of “${String(data.get("title"))}”.`);
@@ -343,6 +382,7 @@ export function ButtonFormActions() {
343
382
  </Button>
344
383
  <Button
345
384
  className="demo-btn"
385
+ whilePending="ignore"
346
386
  formAction={async () => {
347
387
  await fakeSave("the discard", { ms: 2500 });
348
388
  record("Discarded.");
@@ -362,14 +402,18 @@ export function ButtonFormActions() {
362
402
 
363
403
  A Button is `type="button"` by default, so an `action` Button never submits the form it sits in. With `formAction` it is a submit button that runs its own function instead of the form's `action`: constraint validation, `FormData` and React's automatic form reset all apply. It is pending for its own submissions only (React reports the submitter's function through `useFormStatus().action`).
364
404
 
405
+ > **Overlapping submissions**
406
+ >
407
+ > By default a second click on a pending `Button formAction` submits the form again, as React's own `<button formAction>` does. Those submissions are React's form channel, and React drops the rejection of an older overlapping submission: it reaches no Error Boundary and no `reportError`, and the library cannot see it. For a submission that must not overlap, use `whilePending="ignore"` (as in the example above), or pass a `useActionState` dispatch, which React runs in order.
408
+
365
409
  | | Form.Submit | Button formAction | Button type="submit" |
366
410
  | - | - | - | - |
367
411
  | Submits | the form's own `action` | its own function instead | the form's own `action` |
368
412
  | `pending` | the form channel: any submitter | its own submissions only | none |
369
- | Re-entry while pending | not blocked (a `useActionState` dispatch queues it, in order) | ignored | none |
413
+ | A click while pending | not blocked (a `useActionState` dispatch queues it, in order) | submits again; ignored with `whilePending="ignore"` | none |
370
414
  | Use | the one primary submit button | secondary submitters | rarely; `Form.Submit` is the documented spelling |
371
415
 
372
- Inside a [Form.Root](field.md), a `Button formAction` goes React's way: its function runs, the form's `action` does not, and `Form.Root` shows `data-pending` as for any submission (its `errors` are not fed by it; to route field errors, pass the dispatch of the same `useActionState` as `formAction`). Implicit submission (Enter in a text field) clicks the form's first submit button: if that is a pending `Button formAction`, the click is ignored and nothing is submitted twice.
416
+ Inside a [Form.Root](field.md), a `Button formAction` goes React's way: its function runs, the form's `action` does not, and `Form.Root` shows `data-pending` as for any submission (its `errors` are not fed by it; to route field errors, pass the dispatch of the same `useActionState` as `formAction`). Implicit submission (Enter in a text field) clicks the form's first submit button: if that is a pending `Button formAction`, it submits again, or with `whilePending="ignore"` the click is ignored and nothing is submitted twice.
373
417
 
374
418
  > **Which button?**
375
419
  >
@@ -459,6 +503,6 @@ export function ButtonCompose() {
459
503
  }
460
504
  ```
461
505
 
462
- `<Dialog.Trigger render={<Button action={a} />}>` runs `a` and opens the dialog on one click: the Trigger's handler runs first and cancels the click (its command), and the Button runs its action anyway; a cancelled click is not a veto for a Button. The two updates start in one event, so React commits them together: **an awaited `a` holds the dialog closed until it settles** (the Trigger already shows `data-open` and `data-pending`). For a prefetch, do not await it, as above. The same works with `Popover.Trigger` and `Tooltip.Trigger`; a Tooltip keeps opening on hover and focus while the Button is pending, because a pending Button is not natively disabled and removes no listeners.
506
+ `<Dialog.Trigger render={<Button action={a} />}>` runs `a` and opens the dialog on one click: the Trigger's handler runs first and cancels the click (its command), and the Button runs its action anyway; a cancelled click is not a veto for a Button. The two updates start in one event, so React commits them together: **an awaited `a` holds the dialog closed until it settles** (the Trigger already shows `data-open` and `data-pending`). For a prefetch, do not await it, as above. The same works with `Popover.Trigger` and `Tooltip.Trigger`; a Tooltip keeps opening on hover and focus while the Button is pending, because a pending Button is not natively disabled and removes no listeners. A second click on the Trigger runs `a` again unless the Button has `whilePending="ignore"`.
463
507
 
464
- `commandfor` / `command` pass through: without `action` the browser runs the command, before and after hydration. With both, one click runs the action and the command; while pending, neither runs again. Inside a [Toolbar](toolbar.md) a disabled Button stays focusable and in the arrow-key sequence (`aria-disabled`, the APG Toolbar rule).
508
+ `commandfor` / `command` pass through: without `action` the browser runs the command, before and after hydration. With both, one click runs the action and the command; a click while pending runs both again, or with `whilePending="ignore"` neither. Inside a [Toolbar](toolbar.md) a disabled Button stays focusable and in the arrow-key sequence (`aria-disabled`, the APG Toolbar rule).
@@ -202,7 +202,16 @@ import { CheckboxGroup } from "@funstack/ui/checkbox-group";
202
202
  > }}
203
203
  > ```
204
204
  >
205
- > Uncontrolled groups need none of this: the latest dispatch already contains the earlier clicks.
205
+ > Uncontrolled groups need none of this: once every overlapping save has settled, the group commits each change whose save resolved, in click order, and leaves out one whose save rejected.
206
+ >
207
+ > One exception, in both modes: a form reset (`reason: "platform"` with `details.event?.type === "reset"`) replaces the whole value, so save its `next` whole. Its `added` / `removed` are only the diff from what was intended and can be empty, for example when a pending uncheck is reset away. If your saves must not overlap at all, queue them with React's [`useActionState`](https://react.dev/reference/react/useActionState) and call its dispatch from the action.
208
+ >
209
+ > ```tsx
210
+ > valueChangeAction={async (next, details) => {
211
+ > if (details.reason === "platform" && details.event?.type === "reset") await saveAll(next);
212
+ > else await save(details.added, details.removed);
213
+ > }}
214
+ > ```
206
215
 
207
216
  ## Props
208
217
 
@@ -337,7 +346,7 @@ Items and the Parent render the optimistic set into their native inputs. `data-p
337
346
  1. Click Ham: the browser checks it; the group dispatches `valueChangeAction(["cheese", "ham"], { reason: "activate", added: ["ham"], removed: [] })` in the Root's transition. The Root and the Ham box get `data-pending`; a Parent over both values shows checked at once.
338
347
  2. Resolve: the set is committed (uncontrolled) and the attributes go.
339
348
  3. Reject: the optimistic set reverts, React writes `checked` back, the Parent returns to mixed, and the error reaches the nearest Error Boundary.
340
- 4. Clicks while a save is pending stack: each dispatch is computed from what the user sees, and only the latest commits.
349
+ 4. Clicks while a save is pending stack: each dispatch is computed from what the user sees. Uncontrolled, once every save has settled, the changes whose saves resolved are committed in click order. An earlier click whose save rejected is left out, and its error goes to `reportError` rather than the Error Boundary (see [Overlapping actions](../concepts/action-props.md#overlapping-actions)).
341
350
 
342
351
  ## Suspense
343
352
 
@@ -452,7 +461,7 @@ export function CheckboxGroupForm() {
452
461
  - With a real `name`, every checked Item posts `name=value`; read them with `formData.getAll(name)`. Parents post nothing.
453
462
  - **`required` means "at least one"**. HTML has no group constraint, so the Root renders native `required` on every Item while no enabled Item is checked (following the optimistic state) and on none once one is. A checked disabled Item and a value with no Item do not count: neither is submitted. Validation, the browser's localised message and `:user-invalid` stay native; the message reads "check this box". Disabled boxes are not validated, so a disabled group never blocks a submit.
454
463
  - Before hydration the attribute is whatever the server rendered, and the server cannot know which values have an enabled Item, so it counts any checked value. In an empty required group every box is required, so a user who checks one box and submits before hydration is still blocked by another box until hydration (over-blocking). A group whose only checked values are disabled Items or have no Item renders no `required` on the server, so a submit before hydration is not blocked (under-blocking, until hydration); validate on the server as well.
455
- - **Form reset** (the Reset button, `form.reset()`, or React's automatic reset after the action succeeds) is one dispatch for the whole group, with `reason: "platform"`, the `reset` event, and the diff in `added` / `removed`. Uncontrolled, the target is the latest `defaultValue`; controlled, the mount-time values are offered to the parent.
464
+ - **Form reset** (the Reset button, `form.reset()`, or React's automatic reset after the action succeeds) is one dispatch for the whole group, with `reason: "platform"`, the `reset` event, and the diff in `added` / `removed`. Uncontrolled, the target is the latest `defaultValue`, and the reset replaces the value whole: it is dispatched even with an empty diff while a change is still pending, so a pending change that fails later cannot bring its box back after the reset. Controlled, the mount-time values are offered to the parent.
456
465
  - **Clicks before hydration** work natively, on Items and on Parents. On hydration the Root dispatches once for everything it finds changed, with no event; a Parent clicked before hydration counts as "check all" (or "uncheck all") of its enabled values. The order of those clicks is not preserved: a Parent click is applied after the Items' state is read, so an Item clicked after the Parent before hydration is overridden by the Parent. Items that hydrate later, inside a Suspense boundary, are reconciled when they do; unlike RadioGroup, a group split across Suspense boundaries works. Firefox restores the Items' checked state on reload, which is reconciled the same way; the Parent is never restored (`autocomplete="off"`), so a restore cannot be taken for a Parent click.
457
466
 
458
467
  ### Server Functions and forms
@@ -241,12 +241,6 @@ export function ComboboxCountry() {
241
241
  }
242
242
  }
243
243
 
244
- /* Keep the CSS exit for dismissals, but not while a view transition runs (Chromium would
245
- capture a fading listbox twice). */
246
- html:active-view-transition .demo-combobox-popup {
247
- transition: none;
248
- }
249
-
250
244
  @media (prefers-reduced-motion: reduce) {
251
245
  .demo-combobox-popup {
252
246
  transition: none;
@@ -286,22 +280,22 @@ import { Combobox } from "@funstack/ui/combobox";
286
280
 
287
281
  ### Typing is urgent; everything it causes is not
288
282
 
289
- "Everything is a transition" has one exception, and this is it: React requires a controlled text input to update urgently, in the same event as the keystroke. So the text is the library's first **urgent state**. It keeps the usual pair, `inputValue` / `defaultInputValue`, but its callback is a handler, not an action: `onInputValueChange` ([the urgent lane](../concepts/action-props.md#urgent-lane)) is called synchronously, outside any transition, and never awaited. A controlled parent simply sets its state in the body:
283
+ React requires a controlled text input to update urgently, in the same event as the keystroke: by the time the library hears of it, the text is already in the DOM. So the text is **urgent state**, a [fact](../concepts/action-props.md#fact) rather than a request. It keeps the usual pair, `inputValue` / `defaultInputValue`, but its callback is a handler, not an action: `onInputValueChange` (an [`on*` handler](../concepts/action-props.md#on-handler)) is called synchronously, outside any transition, and never awaited. A controlled parent simply sets its state in the body:
290
284
 
291
285
  ```tsx
292
286
  const [text, setText] = useState("");
293
287
  <Combobox.Root inputValue={text} onInputValueChange={(next) => setText(next)}>
294
288
  ```
295
289
 
296
- Everything downstream of the text leaves the urgent lane at once:
290
+ Everything downstream of the text is a transition again:
297
291
 
298
292
  - **The results** render from `query`, which is `useDeferredValue(inputValue)`. A slow search never blocks a keystroke; the previous results stay on screen (no fallback flash) with `data-stale` and `aria-busy="true"` until the new ones are ready; and only the latest query is ever rendered, so a slow response for "ja" cannot overwrite the results for "jap".
299
- - **Opening** is a transition (`openChangeAction`).
293
+ - **Opening** is a transition (`openChangeAction`). A dismissal (Escape, a click outside, focus leaving) is a fact, reported to `onOpenChange`.
300
294
  - **Choosing** an option is a transition (`valueChangeAction`) with an optimistic selection, exactly as every other value in the library.
301
295
 
302
296
  > **Do not fetch in onInputValueChange**
303
297
  >
304
- > `onInputValueChange={async (q) => setResults(await search(q))}` brings back every problem the deferred query solves: responses land in completion order, nothing marks the results stale, and the urgent handler is not awaited anyway (development warns when it returns a promise). Read a query-keyed cache with `use()` inside the List instead.
298
+ > `onInputValueChange={async (q) => setResults(await search(q))}` brings back every problem the deferred query solves: responses land in completion order, nothing marks the results stale, and the urgent handler is not awaited anyway. Read a query-keyed cache with `use()` inside the List instead. (Returning a promise is allowed, for work the UI does not wait for such as logging: like every `on*` handler, its rejection goes to `reportError`.)
305
299
 
306
300
  While any async action is pending in the app (this combobox's own slow save included), React holds every transition. Typing is unaffected (urgent), and so are the results: a deferred render is not held by a pending action (verified in Chromium and Firefox). Opening the listbox while a save is pending is a transition, so it waits for the save: the input shows `data-open` and `data-pending` meanwhile, and its `aria-expanded` turns `"true"` when the listbox is shown.
307
301
 
@@ -390,10 +384,11 @@ With `allowCustomValue` the typed text is a value: Enter with no active option,
390
384
  | `valueChangeAction` | `ChangeAction<string \| null, ComboboxValueChangeDetails>` | – | Runs in the Root's transition when the user accepts an option, commits free text, presses Clear, or the form resets. Awaited; the listbox closes in the commit that ends it; a rejection rolls the text and the selection back and leaves the listbox open. May be a Server Function. A `setState` after your own `await` needs `startTransition`. |
391
385
  | `inputValue` | `string` | – | Controlled text. `undefined` means uncontrolled. |
392
386
  | `defaultInputValue` | `string` | `""` | Initial text when uncontrolled, and the visible input's form-reset target. Pass the selected option's label together with `defaultValue`. |
393
- | `onInputValueChange` | `UrgentChangeHandler<string, ComboboxInputValueChangeDetails>` | – | A handler, not an action: [the urgent lane](../concepts/action-props.md#urgent-lane), called synchronously, outside any transition, on every change of the text (typing, and the library's own writes). Not awaited, never pending. Set your state in the body. |
394
- | `open` | `boolean` | – | Controlled open state. `undefined` means uncontrolled. |
387
+ | `onInputValueChange` | `UrgentChangeHandler<string, ComboboxInputValueChangeDetails>` | – | A [handler](../concepts/action-props.md#on-handler), not an action: called synchronously, outside any transition, on every change of the text (typing, and the library's own writes). Not awaited, never pending. Set your state in the body. May return a promise; a rejection or a throw goes to `reportError` ([the rule of every on\* handler](../concepts/action-props.md#handlers)). |
388
+ | `open` | `boolean` | – | Controlled open state. `undefined` means uncontrolled. Pass `onOpenChange` too (development warns). |
395
389
  | `defaultOpen` | `boolean` | `false` | Initial open state; opens after hydration. |
396
- | `openChangeAction` | `ChangeAction<boolean, ComboboxOpenChangeDetails>` | – | Awaited for opens and for the closes the library performs (an accepted option, the Trigger); a notification for dismissals (Escape, a click outside, focus leaving). A [foreign invoker](../concepts/browser-owned-state.md#foreign-invoker) closes it as `"activate"`, a notification; pressing one does not move focus out of the input, so the text is left as typed. |
390
+ | `openChangeAction` | `ChangeAction<boolean, ComboboxOpenChangeDetails>` | – | Requests only: awaited for opens and for the closes a part asks for (an accepted option, the Trigger, Alt+ArrowUp). Never called for a dismissal (`onOpenChange`). Runs in the Root's transition; may be a Server Function. `details.reason`: `"activate"` (typing, ArrowDown / ArrowUp / Alt+ArrowDown, the Trigger, a click on the input with `openOnClick`, an accepted option, Alt+ArrowUp, a foreign `showPopover()`) or `"platform"` (found open on mount, which only script can cause; `event` is `undefined`). |
391
+ | `onOpenChange` | `UrgentChangeHandler<boolean, ComboboxOpenChangeDetails>` | – | Facts only: the listbox was closed without the library closing it on request. Always `false`. `details.reason`: `"dismiss"` (Escape, focus leaving the input, a click outside, a Clear click while open, another popover opening, script) or `"activate"` (a [foreign invoker](../concepts/browser-owned-state.md#foreign-invoker), whose press does not move focus out of the input, so the text is left as typed; a Trigger rendered as another element, pressed while open). Called synchronously in the browser's `toggle` event, outside any transition, and not awaited: nothing is pending and no view transition runs. In controlled mode set state directly here (`onOpenChange={setOpen}`), never in `startTransition` or after an `await`; a parent that keeps `open` gets the listbox shown again at once, with focus left where the dismissal put it. May return a promise (a Server Function); a rejection or a throw goes to `reportError`. |
397
392
  | `allowCustomValue` | `boolean` | `false` | Free text is a value (Enter with no active option, focus leaving), dispatched with `details.custom: true`. Otherwise unmatched text reverts when focus leaves. |
398
393
  | `autoHighlight` | `boolean` | `false` | Make the first enabled option active when the results for an open or an edit settle (APG automatic selection): typing then Enter picks the first match. Stale results are never highlighted, so an Enter before they settle commits the typed text (`allowCustomValue`) or does nothing. |
399
394
  | `openOnClick` | `boolean` | `false` | Open on a click in the input (never on focus alone). |
@@ -409,7 +404,7 @@ With `allowCustomValue` the typed text is a value: Enter with no active option,
409
404
 
410
405
  `multiple` is not part of this version.
411
406
 
412
- `ComboboxValueChangeDetails`: `{ reason, custom, event }`. `reason` is `"activate"` (an accepted option: the `keydown` or `click`; free text: the `keydown` or `focusout`; Clear: the `click`) or `"platform"` (a form reset: the `reset` event). `ComboboxInputValueChangeDetails`: `{ reason, event }`, with `"activate"` for typing (the `input` event), an accepted label and Clear, `"dismiss"` for a revert, `"platform"` for a reset or text found at mount (no event). `ComboboxOpenChangeDetails`: `{ reason, event }`, as Popover's.
407
+ `ComboboxValueChangeDetails`: `{ reason, custom, event }`. `reason` is `"activate"` (an accepted option: the `keydown` or `click`; free text: the `keydown` or `focusout`; Clear: the `click`) or `"platform"` (a form reset: the `reset` event). `ComboboxInputValueChangeDetails`: `{ reason, event }`, with `"activate"` for typing (the `input` event), an accepted label and Clear, `"dismiss"` for a revert, `"platform"` for a reset or text found at mount (no event). `ComboboxOpenChangeDetails`: `{ reason, event }`; the reasons are listed with `openChangeAction` and `onOpenChange` above.
413
408
 
414
409
  ### `Combobox.Label`
415
410
 
@@ -460,7 +455,7 @@ Both keep focus in the input when pressed and focus it when clicked. The Trigger
460
455
 
461
456
  | Prop | Type | Default | Description |
462
457
  | - | - | - | - |
463
- | `keepMounted` | `boolean` | `false` | `false`: the children render only while open. `true`: they stay mounted in a hidden `<Activity>`. |
458
+ | `keepMounted` | `boolean` | `false` | `false`: the children render only while open. `true`: they stay mounted in a hidden `<Activity>`; an action inside that rejects while it is hidden goes to `reportError`, not to an Error Boundary. |
464
459
  | `transition` | `ViewTransitionClass` | – | The `<ViewTransition default>` around the popover element. Animates library-driven opens and closes in every engine. A deferred results render activates it too, so use a map with `default: "none"` (below). Keep it static. |
465
460
  | `className` | `string \| ((state: ComboboxPopupState) => string \| undefined)` | – | A class name, or a function of the part's state. |
466
461
  | `style` | `CSSProperties \| ((state: ComboboxPopupState) => CSSProperties \| undefined)` | – | Inline style, or a function of the part's state. |
@@ -569,7 +564,79 @@ Every value dispatch: `fsui-combobox` and `fsui-combobox-select`. Opens and clos
569
564
 
570
565
  Concept: [Pending & optimistic state](../concepts/pending-and-optimistic.md)
571
566
 
572
- The selected value and the open state are optimistic (`data-selected` on the Input and the Option). `data-pending` is on the Input while a selection or an open is in flight, on the Trigger while an open or close is, and on the Option being chosen. The typed text is urgent, not optimistic (see [the urgent lane](../concepts/action-props.md#urgent-lane)).
567
+ The selected value and the open state are optimistic (`data-selected` on the Input and the Option). `data-pending` is on the Input while a selection or an open is in flight, on the Trigger while an open or close is, and on the Option being chosen. The typed text is urgent, not optimistic (a [fact](../concepts/action-props.md#fact), reported to `onInputValueChange`).
568
+
569
+ ### A slow `openChangeAction`
570
+
571
+ Here every `openChangeAction` call takes 2 seconds, like a server call, and `onOpenChange` logs the dismissals. The Input's `aria-expanded`, and the state the browser exposes on the Trigger, follow the shown listbox:
572
+
573
+ ```tsx title="ComboboxSlowOpen.tsx"
574
+ "use client";
575
+ import { startTransition, useState } from "react";
576
+ import { Combobox } from "@funstack/ui/combobox";
577
+ import type { ComboboxOpenChangeDetails } from "@funstack/ui/combobox";
578
+ import { sleep } from "./fake-api.js";
579
+
580
+ const FRUITS = ["Apple", "Banana", "Cherry", "Grape", "Lemon", "Mango", "Orange", "Pear"];
581
+
582
+ // A slow `openChangeAction`: a pretend server call of 2 seconds for every request. Opening
583
+ // (typing, ArrowDown or the Trigger): the Input and the Trigger get data-open and data-pending at
584
+ // once, the listbox is shown when the action settles. Accepting an option or pressing the Trigger
585
+ // again closes it when the close's action settles. Escape, a click outside and focus leaving are
586
+ // the browser's, a fact: the listbox hides at once, nothing is pending and the action is not
587
+ // called; `onOpenChange` reports it. The Input's `aria-expanded` and the state the browser
588
+ // exposes on the Trigger follow the shown listbox. The readout is plain text, not a live region.
589
+ export function ComboboxSlowOpen() {
590
+ const [log, setLog] = useState("(none yet)");
591
+ const slow = async (open: boolean, { reason }: ComboboxOpenChangeDetails) => {
592
+ const call = `openChangeAction(${open}, "${reason}")`;
593
+ setLog(`${call}: running…`);
594
+ await sleep(2000);
595
+ // After an await: wrap the update in startTransition (React limitation).
596
+ startTransition(() => setLog(`${call}: settled`));
597
+ };
598
+ // A fact: called in the browser's event, not awaited. A plain setState here is urgent.
599
+ const dismissed = (open: boolean, { reason }: ComboboxOpenChangeDetails) => {
600
+ setLog(`onOpenChange(${open}, "${reason}")`);
601
+ };
602
+ return (
603
+ <div className="demo-stack">
604
+ <Combobox.Root openChangeAction={slow} onOpenChange={dismissed}>
605
+ <Combobox.Label>Fruit</Combobox.Label>
606
+ <div className="demo-combobox-field">
607
+ <Combobox.Input className="demo-combobox-input" placeholder="Type or press ArrowDown" />
608
+ <Combobox.Trigger className="demo-combobox-icon" aria-label="Show fruits">
609
+ {({ pending }) => (pending ? <span className="demo-spinner" aria-hidden /> : "▾")}
610
+ </Combobox.Trigger>
611
+ <Combobox.Popup className="demo-combobox-popup">
612
+ <Combobox.List>
613
+ {({ query }) =>
614
+ FRUITS.filter((f) => f.toLowerCase().includes(query.toLowerCase())).map((f) => (
615
+ <Combobox.Option key={f} value={f}>
616
+ {f}
617
+ </Combobox.Option>
618
+ ))
619
+ }
620
+ </Combobox.List>
621
+ <Combobox.Empty className="demo-combobox-status">No fruit matches.</Combobox.Empty>
622
+ </Combobox.Popup>
623
+ </div>
624
+ </Combobox.Root>
625
+ <p className="demo-readout">
626
+ Last: <code>{log}</code>
627
+ </p>
628
+ </div>
629
+ );
630
+ }
631
+ ```
632
+
633
+ `combobox.css`: the same file as above.
634
+
635
+ - Open (type, ArrowDown or the Trigger): the Input and the Trigger get `data-open` and `data-pending` at once and stay collapsed; the listbox is shown and both are expanded when the action settles.
636
+ - Accept an option, or press the Trigger again: the listbox stays shown and both stay expanded until the close's action settles.
637
+ - Escape or a click outside: a fact. The listbox hides and both are collapsed at once; nothing is pending and the slow action is not called; `onOpenChange` is.
638
+
639
+ The readout under the example is plain text, not a live region, so it does not interrupt a screen reader.
573
640
 
574
641
  ## Suspense
575
642
 
@@ -581,7 +648,7 @@ Results render from a deferred copy of the text (`useDeferredValue`), so an asyn
581
648
 
582
649
  Concept: [Browser-owned state](../concepts/browser-owned-state.md)
583
650
 
584
- The listbox is a popover: a dismissal (Escape, a click outside, another popover opening) is the browser's. Focus leaving the input is closed by the library but reported the same way. Either way `openChangeAction(false)` is a notification with `reason: "dismiss"`.
651
+ The listbox is a popover: a dismissal (Escape, a click outside, another popover opening) is the browser's. Focus leaving the input is closed by the library at once, which it cannot hold either. Either way it is a fact: `onOpenChange(false)` with `reason: "dismiss"`, nothing pending.
585
652
 
586
653
  ## Before hydration
587
654
 
@@ -621,11 +688,7 @@ A plain text field: typing works and the form posts the default selection (and t
621
688
 
622
689
  Types: every value dispatch adds `fsui-combobox` and `fsui-combobox-select`; opens and closes add `fsui-combobox-open` / `fsui-combobox-close`.
623
690
 
624
- With both the CSS exit above and `transition`, turn the CSS exit off while a view transition runs ([A popup with a CSS exit and a view transition](../concepts/transitions.md#css-exit)):
625
-
626
- ```css
627
- html:active-view-transition .listbox { transition: none; }
628
- ```
691
+ Keep the CSS exit above next to `transition`: it animates the dismissals (focus leaving, Escape, a click outside). The library turns the popup's CSS transitions off for the moment of its own show and hide while a view transition runs, so you need no extra rule ([A popup with a CSS exit and a view transition](../concepts/transitions.md#css-exit)).
629
692
 
630
693
  ## Browser notes
631
694
 
@@ -375,15 +375,15 @@ Those options are shipped CSS: a `<style>` React hoists into `<head>` once per p
375
375
 
376
376
  ### Moving and closing
377
377
 
378
- | Input | What happens | reason |
378
+ | Input | What happens | Reported as |
379
379
  | - | - | - |
380
380
  | Right-click elsewhere in the region while open | The menu moves to the new point: no `openChangeAction`, items keep their state, a pending item action keeps running, the first item is focused again | – |
381
- | Right-click or middle-click outside the menu | Closes at once, for every menu (a Menu opened from its button too): the browser's own light dismiss ignores those buttons in Chromium, and native menus close on any click | `"dismiss"` |
381
+ | Right-click or middle-click outside the menu | Closes at once, for every menu (a Menu opened from its button too): the browser's own light dismiss ignores those buttons in Chromium, and native menus close on any click | `onOpenChange`, `"dismiss"` |
382
382
  | Right-click inside the menu | Nothing: the browser's menu is suppressed, the menu stays where it is | – |
383
- | Release of the held button or finger over an item, after sliding onto it | The item is activated, as a click would (see Press-drag-release) | `"activate"` |
384
- | Release of the held button outside the menu, after moving, at least 500 ms after the menu appeared | Closes at once | `"dismiss"` |
385
- | A scroll of the page, or of a scroller around the region | Closes at once (a menu at a point only; see Scrolling) | `"dismiss"` |
386
- | An item's activation, Escape, Tab, a left click outside | As Menu | `"activate"` / `"dismiss"` |
383
+ | Release of the held button or finger over an item, after sliding onto it | The item is activated, as a click would (see Press-drag-release) | `openChangeAction`, `"activate"` |
384
+ | Release of the held button outside the menu, after moving, at least 500 ms after the menu appeared | Closes at once | `onOpenChange`, `"dismiss"` |
385
+ | A scroll of the page, or of a scroller around the region | Closes at once (a menu at a point only; see Scrolling) | `onOpenChange`, `"dismiss"` |
386
+ | An item's activation, Escape, Tab, a left click outside | As Menu | the activation: `openChangeAction`, `"activate"`; the others: `onOpenChange`, `"dismiss"` |
387
387
 
388
388
  Focus after a close is the platform's: the element focused when the menu opened. A right-click on a region that cannot take focus leaves focus on `<body>` (the right-button press already moved it there, as with native menus); with a `Menu.Trigger` in the same Root, focus goes to that button instead.
389
389
 
@@ -492,7 +492,7 @@ Items that suspend hold the open, with `data-pending` on the region (and on a Tr
492
492
 
493
493
  Concept: [Browser-owned state](../concepts/browser-owned-state.md)
494
494
 
495
- As in Menu: light dismiss and Escape are the browser's; a dismissal is notified with `reason: "dismiss"`.
495
+ As in Menu: light dismiss and Escape are the browser's; a dismissal is a fact, reported to `onOpenChange` with `reason: "dismiss"`. So are the closes the library performs at once and cannot hold: a right- or middle-click outside, a scroll under a menu placed at a point, a release outside after a long press.
496
496
 
497
497
  ## Before hydration
498
498
 
@@ -509,7 +509,7 @@ The browser's own context menu shows. Nothing is half-open and nothing is replay
509
509
  .menu[data-context] { margin: 0; } /* point-placed: no anchored gap */
510
510
  ```
511
511
 
512
- - The Menu styles apply as they are (`margin: 0; inset: auto` on the popup is what a point-placed menu wants too). Enter and exit CSS and `transition` as Menu: the open and library-driven closes animate with `transition`; dismissals and the outside right-click with CSS; a move is instant.
512
+ - The Menu styles apply as they are (`margin: 0; inset: auto` on the popup is what a point-placed menu wants too). Enter and exit CSS and `transition` as Menu: the open and library-driven closes animate with `transition`; dismissals and the outside right-click are facts and animate with CSS only (no view transition); a move is instant.
513
513
  - On iOS a long-press over text starts a selection and the loupe. Only a `user-select: none` that applies before the touch starts prevents it, and then the text cannot be selected by touch, so it is your choice, not a library default. The region already suppresses the link and image callout inline.
514
514
 
515
515
  ## Browser notes