@ui-sdk/svelte 0.1.0-beta.8 → 0.1.0-beta.9

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.
@@ -22,6 +22,7 @@ The dialog itself, named by its title and described by its description.
22
22
  initialFocus,
23
23
  finalFocus,
24
24
  keepMounted,
25
+ inline,
25
26
  container,
26
27
  ...rest
27
28
  }: PartProps<"div", DialogContentState<Payload>> &
@@ -37,13 +38,18 @@ The dialog itself, named by its title and described by its description.
37
38
  // what moves into the container and the top layer. An alert dialog never
38
39
  // presents as a sheet, so it has no viewport to bind.
39
40
  const viewport = dialog.sheet
40
- ? useHandlePart(dialog.handle, "viewport", () => ({}), portalTo(target))
41
+ ? useHandlePart(
42
+ dialog.handle,
43
+ "viewport",
44
+ () => ({}),
45
+ portalTo(() => (inline ? false : target()))
46
+ )
41
47
  : undefined
42
48
  const content = useHandlePart(
43
49
  dialog.handle,
44
50
  "content",
45
- () => ({ initialFocus, finalFocus, keepMounted }),
46
- portalTo(() => (viewport?.present ? false : target()))
51
+ () => ({ initialFocus, finalFocus, keepMounted, inline }),
52
+ portalTo(() => (inline || viewport?.present ? false : target()))
47
53
  )
48
54
  </script>
49
55
 
@@ -14,6 +14,7 @@ declare function $$render<Payload = unknown>(): {
14
14
  initialFocus?: import("@ui-sdk/core/dialog").DialogInitialFocus;
15
15
  finalFocus?: import("@ui-sdk/core/dialog").DialogFinalFocus;
16
16
  keepMounted?: boolean;
17
+ inline?: boolean;
17
18
  } & {
18
19
  /** Renders the popup into this element instead of in place. */
19
20
  container?: PopupContainer;
@@ -1,4 +1,4 @@
1
- import type { DrawerContentState } from "@ui-sdk/core/drawer";
1
+ import type { DrawerContentProps, DrawerContentState } from "@ui-sdk/core/drawer";
2
2
  import { type PopupContainer } from "../popup.svelte";
3
3
  declare function $$render<Payload = unknown>(): {
4
4
  props: Omit<import("svelte/elements").HTMLAttributes<HTMLDivElement>, "children"> & {
@@ -10,11 +10,7 @@ declare function $$render<Payload = unknown>(): {
10
10
  children?: import("svelte").Snippet<[DrawerContentState<Payload>]> | undefined;
11
11
  }]> | undefined;
12
12
  children?: import("svelte").Snippet<[DrawerContentState<Payload>]> | undefined;
13
- } & import("@ui-sdk/core").PortalProps & {
14
- initialFocus?: import("@ui-sdk/core/dialog").DialogInitialFocus;
15
- finalFocus?: import("@ui-sdk/core/dialog").DialogFinalFocus;
16
- keepMounted?: boolean;
17
- } & {
13
+ } & DrawerContentProps & {
18
14
  /** Renders the drawer into this element instead of in place. */
19
15
  container?: PopupContainer;
20
16
  };
@@ -36,6 +36,7 @@ An always-visible list to choose one option from, or several with `multiple`.
36
36
  deselectable,
37
37
  orientation,
38
38
  loop,
39
+ virtualFocus,
39
40
  keepInView,
40
41
  items,
41
42
  itemToValue,
@@ -66,6 +67,8 @@ An always-visible list to choose one option from, or several with `multiple`.
66
67
  orientation?: "horizontal" | "vertical"
67
68
  /** Whether arrow keys wrap from the last item to the first. */
68
69
  loop?: boolean
70
+ /** Keeps focus on the list, which points at the highlighted option with `aria-activedescendant`. */
71
+ virtualFocus?: boolean
69
72
  /** Whether the list scrolls the option keys move to into view, and the selected option when it first shows. */
70
73
  keepInView?: boolean
71
74
  /** The items as data. Renders them for you. */
@@ -107,6 +110,7 @@ An always-visible list to choose one option from, or several with `multiple`.
107
110
  deselectable,
108
111
  orientation,
109
112
  loop,
113
+ virtualFocus,
110
114
  keepInView,
111
115
  items,
112
116
  itemToValue,
@@ -17,6 +17,8 @@ type $$ComponentProps = PartProps<"div", ListboxState> & {
17
17
  orientation?: "horizontal" | "vertical";
18
18
  /** Whether arrow keys wrap from the last item to the first. */
19
19
  loop?: boolean;
20
+ /** Keeps focus on the list, which points at the highlighted option with `aria-activedescendant`. */
21
+ virtualFocus?: boolean;
20
22
  /** Whether the list scrolls the option keys move to into view, and the selected option when it first shows. */
21
23
  keepInView?: boolean;
22
24
  /** The items as data. Renders them for you. */
@@ -32,6 +32,7 @@ The panel itself, positioned against its trigger, named by its title and describ
32
32
  initialFocus,
33
33
  finalFocus,
34
34
  keepMounted,
35
+ inline,
35
36
  container,
36
37
  ...rest
37
38
  }: PartProps<"div", PopoverContentState<Payload>> &
@@ -50,7 +51,7 @@ The panel itself, positioned against its trigger, named by its title and describ
50
51
  popover,
51
52
  "viewport",
52
53
  () => ({}),
53
- portalTo(target)
54
+ portalTo(() => (inline ? false : target()))
54
55
  )
55
56
  const content = useHandlePart(
56
57
  popover,
@@ -66,8 +67,9 @@ The panel itself, positioned against its trigger, named by its title and describ
66
67
  initialFocus,
67
68
  finalFocus,
68
69
  keepMounted,
70
+ inline,
69
71
  }),
70
- portalTo(() => (viewport.present ? false : target()))
72
+ portalTo(() => (inline || viewport.present ? false : target()))
71
73
  )
72
74
  </script>
73
75
 
@@ -18,6 +18,7 @@ declare function $$render<Payload = unknown>(): {
18
18
  initialFocus?: import("@ui-sdk/core/popover").PopoverInitialFocus;
19
19
  finalFocus?: import("@ui-sdk/core/popover").PopoverFinalFocus;
20
20
  keepMounted?: boolean;
21
+ inline?: boolean;
21
22
  } & {
22
23
  /** Renders the popup into this element instead of in place. */
23
24
  container?: PopupContainer;
@@ -92,6 +92,7 @@ Picks one value, or several with `multiple`, from a list in a popup.
92
92
  itemToLabel,
93
93
  isItemEqualToValue,
94
94
  loop,
95
+ virtualFocus,
95
96
  modal,
96
97
  presentation,
97
98
  disabled,
@@ -141,6 +142,8 @@ Picks one value, or several with `multiple`, from a list in a popup.
141
142
  isItemEqualToValue?: (itemValue: T, value: T) => boolean
142
143
  /** Whether arrow keys wrap from the last item to the first. */
143
144
  loop?: boolean
145
+ /** Keeps focus on the trigger while the list is open, which points at the highlighted item. */
146
+ virtualFocus?: boolean
144
147
  /** Whether the page behind the list is inert, or only shielded from the pointer. */
145
148
  modal?: boolean | "pointer"
146
149
  /** How the list presents: a popover, a sheet, or `"auto"` for a sheet on small touch screens. */
@@ -210,6 +213,7 @@ Picks one value, or several with `multiple`, from a list in a popup.
210
213
  itemToLabel,
211
214
  isItemEqualToValue,
212
215
  loop,
216
+ virtualFocus,
213
217
  modal,
214
218
  presentation,
215
219
  disabled: disabled || field?.disabled(),
@@ -33,6 +33,8 @@ declare function $$render<T = string, Multiple extends boolean | undefined = fal
33
33
  isItemEqualToValue?: (itemValue: T, value: T) => boolean;
34
34
  /** Whether arrow keys wrap from the last item to the first. */
35
35
  loop?: boolean;
36
+ /** Keeps focus on the trigger while the list is open, which points at the highlighted item. */
37
+ virtualFocus?: boolean;
36
38
  /** Whether the page behind the list is inert, or only shielded from the pointer. */
37
39
  modal?: boolean | "pointer";
38
40
  /** How the list presents: a popover, a sheet, or `"auto"` for a sheet on small touch screens. */
@@ -675,6 +675,7 @@ Dims the page behind the dialog. Renders a `div` and accepts its attributes and
675
675
  - `initialFocus?` (`DialogInitialFocus`): Where focus goes when the dialog opens. Opening with touch focuses the dialog itself, so no on-screen keyboard appears.
676
676
  - `finalFocus?` (`PopupFocusTarget`): Where focus goes when the dialog closes while focus is inside it.
677
677
  - `keepMounted?` (`boolean`): Whether the dialog stays in the page, hidden, while closed. Its content keeps its state between opens.
678
+ - `inline?` (`boolean`): Renders the dialog and its backdrop where they are in the page instead of above it, so it can stay inside a frame, like an app preview. Pair it with `modal="trap-focus"` to keep the rest of the page usable. A `container` on the dialog still moves its backdrop, so leave it off.
678
679
 
679
680
  ### AlertDialogTitle
680
681
 
@@ -1770,6 +1770,8 @@ Create one with `createAutocompleteController()` and pass it as `controller`.
1770
1770
  - `getValue()` (`() => string`): The text.
1771
1771
  - `setValue(value, options?)` (`(value: string, options?: AutocompleteChangeOptions<AutocompleteValueChangeReason> | undefined) => boolean`): Changes the text, which filters the suggestions. Returns false when the change was canceled or nothing changed.
1772
1772
  - `clear(options?)` (`(options?: AutocompleteChangeOptions<AutocompleteValueChangeReason> | undefined) => boolean`): Empties the field. Returns false when the change was canceled or nothing changed.
1773
+ - `getHighlighted()` (`() => string | null`): The value of the highlighted suggestion, or null when none is.
1774
+ - `highlight(value)` (`(value: string | null) => boolean`): Highlights the suggestion with this value in the open list, scrolled into view, or none with null. Returns false when the suggestions are closed, or no enabled suggestion has the value.
1773
1775
  - `focus()` (`() => void`): Moves focus to the field.
1774
1776
 
1775
1777
  ### Events
@@ -3182,6 +3182,8 @@ Every write method takes an optional `{ reason, event }`, passed to the change c
3182
3182
  - `clear(options?)` (`(options?: ComboboxChangeOptions<ComboboxValueChangeReason> | undefined) => boolean`): Selects nothing and empties the input. Returns false when the change was canceled or nothing changed.
3183
3183
  - `getQuery()` (`() => string`): The input's text.
3184
3184
  - `setQuery(query, options?)` (`(query: string, options?: ComboboxChangeOptions<ComboboxQueryChangeReason> | undefined) => boolean`): Changes the input's text, which filters the list. Returns false when the change was canceled or nothing changed.
3185
+ - `getHighlighted()` (`() => T | null`): The value of the highlighted item, or null when none is.
3186
+ - `highlight(value)` (`(value: T | null) => boolean`): Highlights the item with this value in the open list, scrolled into view, or none with null. Returns false when the list is closed, or no enabled item has the value.
3185
3187
  - `focus()` (`() => void`): Moves focus to the input.
3186
3188
 
3187
3189
  ### Events
@@ -574,6 +574,45 @@ Dialogs render where you put them and use the browser's top layer. Set `containe
574
574
 
575
575
  Choose a mode, open Notes, and try Tab or clicking the page. Check Close on outside press to compare dismissal.
576
576
 
577
+ ## Inside a Frame
578
+
579
+ A dialog opens above the whole page. Set `inline` on the content to keep it and its backdrop where they are in the page, like inside an app preview. Your CSS sizes and places them in their frame. Pair it with `modal="trap-focus"` so the page around the frame stays usable.
580
+
581
+ ```svelte title="inline.svelte"
582
+ <script lang="ts">
583
+ import {
584
+ Dialog,
585
+ DialogBackdrop,
586
+ DialogClose,
587
+ DialogContent,
588
+ DialogDescription,
589
+ DialogTitle,
590
+ DialogTrigger,
591
+ } from "@ui-sdk/svelte/dialog"
592
+ </script>
593
+
594
+ <div data-slot="dialog-frame">
595
+ <Dialog modal="trap-focus" closeOnOutsidePress={false}>
596
+ <DialogTrigger>Delete Draft</DialogTrigger>
597
+ <DialogBackdrop />
598
+ <DialogContent inline>
599
+ <div data-slot="stack">
600
+ <DialogTitle>Delete this draft?</DialogTitle>
601
+ <DialogDescription
602
+ >The preview keeps its dialog inside the frame.</DialogDescription
603
+ >
604
+ </div>
605
+ <div data-slot="row">
606
+ <DialogClose>Cancel</DialogClose>
607
+ <DialogClose data-variant="destructive">Delete</DialogClose>
608
+ </div>
609
+ </DialogContent>
610
+ </Dialog>
611
+ </div>
612
+ ```
613
+
614
+ Open Delete Draft. The dialog and its dim cover only the frame, and Tab stays inside the dialog.
615
+
577
616
  ## Warn Before Closing a Dirty Form
578
617
 
579
618
  Set `dismissible` to false while there are unsaved changes. Escape, an outside press, or a back gesture then keeps the dialog open and reports `onDismissAttempt`. Explicit Close parts and controller calls still work, so you can offer a deliberate way out.
@@ -1070,6 +1109,7 @@ Dims the page behind a modal dialog. Renders a `div`.
1070
1109
  - `initialFocus?` (`DialogInitialFocus`): Where focus goes when the dialog opens. Opening with touch focuses the dialog itself, so no on-screen keyboard appears.
1071
1110
  - `finalFocus?` (`PopupFocusTarget`): Where focus goes when the dialog closes while focus is inside it.
1072
1111
  - `keepMounted?` (`boolean`): Whether the dialog stays in the page, hidden, while closed. Its content keeps its state between opens.
1112
+ - `inline?` (`boolean`): Renders the dialog and its backdrop where they are in the page instead of above it, so it can stay inside a frame, like an app preview. Pair it with `modal="trap-focus"` to keep the rest of the page usable. A `container` on the dialog still moves its backdrop, so leave it off.
1073
1113
 
1074
1114
  ### DialogTitle
1075
1115
 
@@ -24,9 +24,9 @@ Use the following composition to build an `ImageCropper`:
24
24
  ImageCropper
25
25
  ├── ImageCropperViewport
26
26
  │ ├── ImageCropperImage
27
- │ └── ImageCropperSelection
28
- │ ├── ImageCropperGrid
29
- │ └── ImageCropperHandle
27
+ │ ├── ImageCropperSelection
28
+ │ │ └── ImageCropperGrid
29
+ │ └── ImageCropperHandle
30
30
  ├── ImageCropperZoom
31
31
  ├── ImageCropperRotate
32
32
  └── ImageCropperFlip
@@ -37,7 +37,7 @@ ImageCropper
37
37
  - **ImageCropperImage** is the image, turned and flipped. Give it `alt`.
38
38
  - **ImageCropperSelection** shows the crop over the image. It's a slider you drag or move with the arrow keys.
39
39
  - **ImageCropperGrid** draws lines across the selection, in thirds, for you to style.
40
- - **ImageCropperHandle** resizes the selection from one edge or corner, its `position`, like `"se"` for the bottom right.
40
+ - **ImageCropperHandle** resizes the selection from one edge or corner, its `position`, like `"se"` for the bottom right. It goes beside the selection, not inside it, and sits on its edge or corner.
41
41
  - **ImageCropperZoom** is a range input from 1, the largest crop, to `maxZoom`.
42
42
  - **ImageCropperRotate** turns the image a quarter clockwise.
43
43
  - **ImageCropperFlip** mirrors the image left to right, or top to bottom with `direction="vertical"`.
@@ -68,10 +68,9 @@ Import the parts and put them together:
68
68
  <ImageCropper aria-label="Cover photo" {src} aspectRatio={3}>
69
69
  <ImageCropperViewport>
70
70
  <ImageCropperImage alt="Your cover photo" />
71
- <ImageCropperSelection>
72
- <ImageCropperHandle position="nw" />
73
- <ImageCropperHandle position="se" />
74
- </ImageCropperSelection>
71
+ <ImageCropperSelection />
72
+ <ImageCropperHandle position="nw" />
73
+ <ImageCropperHandle position="se" />
75
74
  </ImageCropperViewport>
76
75
  </ImageCropper>
77
76
  ```
@@ -142,10 +141,10 @@ Set `aspectRatio` to keep the crop's width over its height, like `1` for a squar
142
141
  <ImageCropperImage alt="Mountains at sunset" />
143
142
  <ImageCropperSelection>
144
143
  <ImageCropperGrid />
145
- {#each handles as position (position)}
146
- <ImageCropperHandle {position} />
147
- {/each}
148
144
  </ImageCropperSelection>
145
+ {#each handles as position (position)}
146
+ <ImageCropperHandle {position} />
147
+ {/each}
149
148
  </ImageCropperViewport>
150
149
  <div data-slot="row">
151
150
  <ImageCropperFlip>Flip</ImageCropperFlip>
@@ -303,7 +302,7 @@ See [Parts and Composition](../parts-and-composition.md) for the rendering contr
303
302
 
304
303
  ## Styling
305
304
 
306
- Parts are unstyled, apart from the positions they need: the viewport is `position: relative` with `overflow: hidden`, and the image and selection get their place as inline styles in pixels. Give the viewport a size, and the handles a size and a place on their edge or corner of the selection.
305
+ Parts are unstyled, apart from the positions they need: the viewport is `position: relative` with `overflow: hidden`, and the image, the selection and each handle get their place as inline styles in pixels. A handle's place is the point on its edge or corner, so give it a size and center it with `translate: -50% -50%`. Give the viewport a size too.
307
306
 
308
307
  A box viewport fits the whole image, so set its `aspect-ratio` to `--image-cropper-aspect-ratio`. A wide `box-shadow` on the selection dims the image outside it. Show the grid only while `data-dragging` is on it.
309
308
 
@@ -527,6 +526,7 @@ Every line below is an automated test.
527
526
 
528
527
  - A drag moves the selection over the image and commits once.
529
528
  - A handle resizes from its corner, within the image.
529
+ - Each handle sits on its edge or corner of the selection, and follows it.
530
530
  - At a ratio, a handle keeps it.
531
531
  - Escape during a drag puts the selection back.
532
532
 
@@ -147,7 +147,7 @@ Choose Basil, then hold Shift and choose Pepper to select a range. Use Ctrl+A or
147
147
 
148
148
  ## Selection That Follows Focus
149
149
 
150
- A single list selects as arrow keys, Home, End, or typing move focus. A multiple list can do the same with `activation="automatic"`, like a file list: a press or arrow replaces the selection, Ctrl or Cmd adds to it, and Ctrl or Cmd with an arrow moves focus without selecting.
150
+ A single list selects as arrow keys, Page Up and Page Down, Home, End, or typing move focus. Page Up and Page Down move ten options, and stop at the ends. A multiple list can do the same with `activation="automatic"`, like a file list: a press or arrow replaces the selection, Ctrl or Cmd adds to it, and Ctrl or Cmd with an arrow moves focus without selecting.
151
151
 
152
152
  Taps and screen-reader presses toggle an option instead, since they do not have modifier keys.
153
153
 
@@ -238,6 +238,51 @@ Set `activation="manual"` on a single list to browse without selecting. Space, E
238
238
 
239
239
  Move through the options with the arrow keys. Nothing is selected until you press Space or Enter, and the console logs the choice.
240
240
 
241
+ ## Focus on the List
242
+
243
+ Set `virtualFocus` to keep focus on the list itself while arrow keys, Home, End, and typing move a highlight through the options. The list points at the highlighted option with `aria-activedescendant`, so screen readers still announce it. Style the highlight with `[data-highlighted]`, since the options don't take focus.
244
+
245
+ ```svelte title="virtual-focus.svelte"
246
+ <script lang="ts">
247
+ import { CheckIcon } from "@lucide/svelte"
248
+ import {
249
+ Listbox,
250
+ ListboxItem,
251
+ ListboxItemIndicator,
252
+ } from "@ui-sdk/svelte/listbox"
253
+ import { useLog } from "./log"
254
+
255
+ const frameworks = [
256
+ { value: "next", label: "Next.js" },
257
+ { value: "remix", label: "Remix" },
258
+ { value: "astro", label: "Astro" },
259
+ { value: "nuxt", label: "Nuxt" },
260
+ { value: "sveltekit", label: "SvelteKit" },
261
+ ]
262
+
263
+ const log = useLog()
264
+ </script>
265
+
266
+ <Listbox
267
+ activation="manual"
268
+ virtualFocus
269
+ onValueChange={(value, details) =>
270
+ log(`${value ?? "Nothing"} (${details.reason})`)}
271
+ aria-label="Framework"
272
+ >
273
+ {#each frameworks as framework (framework.value)}
274
+ <ListboxItem value={framework.value}>
275
+ {framework.label}
276
+ <ListboxItemIndicator>
277
+ <CheckIcon aria-hidden="true" />
278
+ </ListboxItemIndicator>
279
+ </ListboxItem>
280
+ {/each}
281
+ </Listbox>
282
+ ```
283
+
284
+ Tab into the list and move through it with the arrow keys. Focus stays on the list, and Space or Enter chooses the highlighted option.
285
+
241
286
  ## Deselectable
242
287
 
243
288
  Add `deselectable` to let pressing the selected option clear a single selection. Without it, the selection stays as it is.
@@ -812,6 +857,7 @@ Props and callbacks are the same as below, as Svelte props. `value` can be bound
812
857
  - `deselectable?` (`boolean`): Whether pressing the selected item of a single listbox unselects it, so nothing is selected.
813
858
  - `orientation?` (`"horizontal" | "vertical"`): Which arrow keys move between items. Horizontal lists use Left and Right, swapped in right-to-left text.
814
859
  - `loop?` (`boolean`): Whether arrow keys wrap from the last item to the first. Shift with an arrow never wraps.
860
+ - `virtualFocus?` (`boolean`): Keeps focus on the list itself, which points at the highlighted option with `aria-activedescendant`, instead of moving focus onto the options.
815
861
  - `keepInView?` (`boolean`): Whether the list scrolls the option keys move to into view, and the selected option when it first shows. Turn it off when something else scrolls the list, like `bindScrollPicker`.
816
862
  - `items?` (`ListData<T>`): The items as data. Renders them for you, and lets typing find items a virtualized list hasn't rendered.
817
863
  - `itemToValue?` (`((value: T) => string)`): The string an item's value submits as and is identified by, for object values. Strings pass through, and objects use their `value` or `id`.
@@ -889,6 +935,8 @@ Every write method takes an optional `{ reason, event }`, passed to `onValueChan
889
935
  - `setValue(value, options?)` (`(value: ListboxValue<T, Multiple>, options?: ListboxChangeOptions | undefined) => boolean`): Selects a value, as a user would. A disabled or read-only listbox ignores it. Returns false when the change was canceled or nothing changed.
890
936
  - `clear(options?)` (`(options?: ListboxChangeOptions | undefined) => boolean`): Selects nothing: `null`, or an empty list with `multiple`. Returns false when the change was canceled or nothing changed.
891
937
  - `selectAll(options?)` (`(options?: ListboxChangeOptions | undefined) => boolean`): Selects every enabled item, with `multiple`. Returns false when the change was canceled or nothing changed.
938
+ - `getHighlighted()` (`() => T | null`): The value of the highlighted option, or null when none is, like while focus is outside the list.
939
+ - `highlight(value)` (`(value: T | null) => boolean`): Highlights the option with this value, scrolled into view, or none with null. While focus is outside the list, the option takes the tab stop instead, so focus lands on it next. Returns false when no enabled option has the value.
892
940
  - `focus()` (`() => void`): Moves focus into the list, onto the option that holds its tab stop.
893
941
 
894
942
  ### Events
@@ -907,7 +955,7 @@ Follows the [WAI-ARIA listbox pattern](https://www.w3.org/WAI/ARIA/apg/patterns/
907
955
 
908
956
  ### Focus
909
957
 
910
- The list is one tab stop. Tab returns to the last focused option, then falls back to the first selected or enabled option. Options receive real DOM focus, so `focus-visible` works directly.
958
+ The list is one tab stop. Tab returns to the last focused option, then falls back to the first selected or enabled option. Options receive real DOM focus, so `focus-visible` works directly. With `virtualFocus`, the list is the tab stop and keeps focus instead.
911
959
 
912
960
  The root forwards focus into the options, including when you press a Field label or the list’s padding. Escape stays available to an enclosing dialog.
913
961
 
@@ -1013,6 +1061,11 @@ Beyond the pattern:
1013
1061
 
1014
1062
  - Taps toggle where clicks replace, since touch has no modifier keys.
1015
1063
 
1064
+ **Focus on the list**
1065
+
1066
+ - With virtualFocus, keys move the highlight while focus stays on the list, which points at it.
1067
+ - With virtualFocus, a press chooses an option and keeps focus on the list.
1068
+
1016
1069
  Runs in React, Vue and web components.
1017
1070
 
1018
1071
  Screen readers hear the same thing in each tested framework, recorded by a virtual screen reader:
@@ -1087,6 +1087,42 @@ Popovers render in place by default and use the browser's top layer. `container`
1087
1087
  </Popover>
1088
1088
  ```
1089
1089
 
1090
+ ## In Place
1091
+
1092
+ A popover opens above the page. Set `inline` on the content to render it where it is, inside its parent's layout and stacking, like a panel that opens out of a corner widget. Your CSS places it, so `side`, `align` and the offsets don't apply.
1093
+
1094
+ ```svelte title="inline.svelte"
1095
+ <script lang="ts">
1096
+ import {
1097
+ Popover,
1098
+ PopoverClose,
1099
+ PopoverContent,
1100
+ PopoverDescription,
1101
+ PopoverTitle,
1102
+ PopoverTrigger,
1103
+ } from "@ui-sdk/svelte/popover"
1104
+ </script>
1105
+
1106
+ <div data-slot="popover-frame">
1107
+ <div data-slot="popover-corner">
1108
+ <Popover>
1109
+ <PopoverTrigger>Feedback</PopoverTrigger>
1110
+ <PopoverContent inline>
1111
+ <PopoverTitle>Send feedback</PopoverTitle>
1112
+ <PopoverDescription
1113
+ >The panel sits in the corner box, above its trigger.</PopoverDescription
1114
+ >
1115
+ <div data-slot="row">
1116
+ <PopoverClose>Close</PopoverClose>
1117
+ </div>
1118
+ </PopoverContent>
1119
+ </Popover>
1120
+ </div>
1121
+ </div>
1122
+ ```
1123
+
1124
+ Open Feedback. The panel opens above the button, inside the corner box.
1125
+
1090
1126
  ## Custom Rendering
1091
1127
 
1092
1128
  Every part takes a `render` snippet, which receives the props to spread and the part's state, and the `children` snippet receives the state too. The content's `children` snippet can read its payload, as the row editor does.
@@ -1234,6 +1270,7 @@ A trigger outside the popover also takes `controller`.
1234
1270
  - `initialFocus?` (`PopoverInitialFocus`): Where focus goes when the popover opens. Opening on hover never moves focus, and opening with touch focuses the popover itself so no on-screen keyboard appears.
1235
1271
  - `finalFocus?` (`PopupFocusTarget`): Where focus goes when the popover closes while focus is inside it.
1236
1272
  - `keepMounted?` (`boolean`): Whether the popover stays in the page, hidden, while closed. Its content keeps its state between opens.
1273
+ - `inline?` (`boolean`): Renders the popover where it is in the page instead of above it, inside its parent's layout and stacking, and leaves placing it to your CSS: `side`, `align` and the offsets don't apply.
1237
1274
 
1238
1275
  ### PopoverArrow
1239
1276
 
@@ -1631,6 +1631,7 @@ Props and callbacks are the same as below, as Svelte props. `value`, `open` and
1631
1631
  - `isItemEqualToValue?` (`((itemValue: T, value: T) => boolean)`): Whether an item's value is the selected value, for object values that aren't the same object.
1632
1632
  - `onHighlight?` (`((value: T | null, details: ListHighlightDetails) => void)`): Runs when the highlight moves, with the item's index among the visible items, so a virtualized list can scroll to it.
1633
1633
  - `loop?` (`boolean`): Whether arrow keys wrap from the last item to the first.
1634
+ - `virtualFocus?` (`boolean`): Keeps focus on the trigger while the list is open, as on a native select: arrow keys, Home, End and typing move the highlight, and the trigger points at the highlighted item with `aria-activedescendant`. A search field in the list still takes focus.
1634
1635
  - `modal?` (`"pointer" | boolean`): `"pointer"`: an outside press only closes the list. `true`: also locks scroll and makes the rest of the page inert. `false`: outside presses reach what they hit.
1635
1636
  - `presentation?` (`PresentationSetting<"popover">`): How the list presents. `"sheet"` slides it up from the bottom of the screen, where it can be swiped away, and `"auto"` does that on small touch screens. Decided each time it opens; the server renders `"popover"` for `"auto"`.
1636
1637
  - `disabled?` (`boolean`): Disables the select like a native one: it can't be focused or changed, and the value isn't submitted.
@@ -1875,6 +1876,8 @@ The select follows the [WAI-ARIA select-only combobox pattern](https://www.w3.or
1875
1876
 
1876
1877
  Arrow keys move through the open list; Home and End reach its first and last items. Set `loop={false}` to stop arrow keys at either end. The popup follows the trigger's inherited text direction; use logical CSS properties for spacing in right-to-left layouts.
1877
1878
 
1879
+ Set `virtualFocus` to keep focus on the trigger while the list is open, as on a native select: arrow keys, Home, End and typing move the highlight, the trigger points at it with `aria-activedescendant`, and Tab closes the list and moves on. A search field in the list still takes focus.
1880
+
1878
1881
  ### Tested Behavior
1879
1882
 
1880
1883
  Every line below is an automated test.
@@ -1964,6 +1967,12 @@ Also tested:
1964
1967
  - A form reset returns the select to its default value.
1965
1968
  - Typing on the closed trigger selects items before the list has ever been in the page.
1966
1969
 
1970
+ **Focus on the trigger**
1971
+
1972
+ - With virtualFocus, keys move the highlight while focus stays on the trigger, which points at it.
1973
+ - With virtualFocus, Tab closes the list and moves on from the trigger.
1974
+ - With virtualFocus, a click on an item chooses it and keeps focus on the trigger.
1975
+
1967
1976
  Runs in React, Vue and web components.
1968
1977
 
1969
1978
  Searching, with a search field in the list:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui-sdk/svelte",
3
- "version": "0.1.0-beta.8",
3
+ "version": "0.1.0-beta.9",
4
4
  "description": "UI SDK for Svelte.",
5
5
  "keywords": [
6
6
  "svelte",
@@ -381,7 +381,7 @@
381
381
  ],
382
382
  "peerDependencies": {
383
383
  "svelte": ">=5.33",
384
- "@ui-sdk/core": "^0.1.0-beta.8"
384
+ "@ui-sdk/core": "^0.1.0-beta.9"
385
385
  },
386
386
  "devDependencies": {
387
387
  "@sveltejs/package": "^2.5.8",
@@ -393,7 +393,7 @@
393
393
  "typescript": "~5.9.3",
394
394
  "vite": "^8.3.3",
395
395
  "vitest": "^5.0.3",
396
- "@ui-sdk/core": "0.1.0-beta.8"
396
+ "@ui-sdk/core": "0.1.0-beta.9"
397
397
  },
398
398
  "scripts": {
399
399
  "build": "node ../../scripts/build/build-svelte-package.mjs",