@estiva-app/ui 0.57.3 → 0.57.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@estiva-app/ui",
3
- "version": "0.57.3",
3
+ "version": "0.57.4",
4
4
  "description": "Estiva's design tokens (the contract) and a small set of primitives (a convenience) for every Estiva app.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/registry.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "kind": "package",
5
5
  "repo": "estiva-ui",
6
6
  "package": "@estiva-app/ui",
7
- "packageVersion": "0.57.3",
7
+ "packageVersion": "0.57.4",
8
8
  "exports": 130,
9
9
  "typeExports": 134,
10
10
  "files": null
@@ -4428,7 +4428,7 @@
4428
4428
  },
4429
4429
  {
4430
4430
  "name": "finalFocus",
4431
- "takes": "RefObject<HTMLElement | null>",
4431
+ "takes": "RefObject<HTMLElement | null> | false",
4432
4432
  "required": false,
4433
4433
  "note": "Where focus goes when the panel closes. With a `trigger` it goes back to the trigger and this is not needed."
4434
4434
  },
@@ -367,6 +367,9 @@ describe('leaving the box', () => {
367
367
  expect(isSuggestionOpen()).toBe(true)
368
368
  await act(async () => other().focus())
369
369
  expect(screen.queryByRole('listbox')).toBeNull()
370
+ // The closing list does not pull focus back into the box that was left.
371
+ await act(async () => new Promise((resolve) => setTimeout(resolve, 50)))
372
+ expect(document.activeElement).toBe(other())
370
373
  // So the other box's own Escape and Enter are its own — no grace either.
371
374
  expect(isSuggestionOpen()).toBe(false)
372
375
  expect(isSuggestionActive()).toBe(false)
package/src/Popover.mdx CHANGED
@@ -99,7 +99,9 @@ so it is the one case the caller drives:
99
99
  - **It does not take focus**, on purpose: the person is still in the text, and
100
100
  a toolbar that moved the caret out of it would end the edit it exists to
101
101
  serve. `finalFocus` is therefore only for a panel something inside it *did*
102
- take focus into — a field the person clicked.
102
+ take focus into — a field the person clicked. `finalFocus={false}` moves
103
+ nothing on close: a panel that closes because focus left for somewhere else
104
+ (a type-ahead list whose box was clicked out of) must not pull it back.
103
105
  - **Render it always and toggle `open`.** Not `{rect && <Popover…>}`: mounting
104
106
  the panel only while it is open takes Base UI's state machine with it, and
105
107
  its exits go too — measured, Escape and re-opening both became intermittent.
package/src/Popover.tsx CHANGED
@@ -82,9 +82,10 @@ export interface PopoverProps {
82
82
  * the trigger and this is not needed. An anchored panel never took focus, so
83
83
  * this only matters when something inside it did — a field the person tabbed
84
84
  * or clicked into: point it at what they came from, or focus is left on the
85
- * document body.
85
+ * document body. `false` moves nothing: a panel that closes because focus
86
+ * left for somewhere else must not pull it back (`SuggestionMenu`).
86
87
  */
87
- finalFocus?: RefObject<HTMLElement | null>
88
+ finalFocus?: RefObject<HTMLElement | null> | false
88
89
  /** Base UI's imperative handle. `actions.current?.close()` shuts the panel —
89
90
  * for the Cancel and Save buttons a form panel ends with. */
90
91
  actionsRef?: RefObject<{ close: () => void; unmount: () => void } | null>
@@ -186,7 +186,8 @@ export function SuggestionMenu<T>({ rect, editorElement, ariaLabel, width, maxHe
186
186
  }
187
187
 
188
188
  return (
189
- <Popover anchor={rect} open={rect !== null} side="top" align="left" className={width} maxHeight={maxHeight} ariaLabel={ariaLabel}>
189
+ // finalFocus={false}: focus never left the text, and a list that closes because focus moved elsewhere must not pull it back (71a4577b).
190
+ <Popover anchor={rect} open={rect !== null} side="top" align="left" className={width} maxHeight={maxHeight} ariaLabel={ariaLabel} finalFocus={false}>
190
191
  {/* The list the editor drives from its caret: a listbox, because Base UI's lists need a text field of their own.
191
192
  `gap-0.5`: 2px between rows, as a menu's — a section with a heading
192
193
  had them from `MenuSection`, and rows without one touched. */}