vue-dockable-desktop 1.6.0 → 1.7.0

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/CHANGELOG.md CHANGED
@@ -11,6 +11,54 @@ correspondence lives, alongside the feature-by-feature map in [docs/PARITY.md](d
11
11
 
12
12
  ## [Unreleased]
13
13
 
14
+ ## [1.7.0] — 2026-10-04
15
+
16
+ **Parity: react-dockable-desktop 7.6.0.** Context menus open with nothing highlighted, the same
17
+ every time.
18
+
19
+ ### Changed
20
+
21
+ - **A context menu opens with focus on the menu itself, no item highlighted.** It used to focus
22
+ its first item, and whether the browser then drew a focus ring depended on the user's previous
23
+ interaction: a menu opened from script (a map library's right-click calling `showContextMenu`,
24
+ say) showed a ring after a page load or a key press and none after a mouse click. ArrowDown
25
+ reaches the first item and ArrowUp the last.
26
+ - **A keyboard `contextmenu` event** (the ContextMenu key or Shift+F10, which report no pointer
27
+ position) **still opens on the first item**, and so does `initialFocus: 'first-item'`.
28
+
29
+ ### Added
30
+
31
+ - **`initialFocus?: 'menu' | 'first-item'`** on `ShowContextMenuOptions`
32
+ (`ws.showContextMenu`, `useContextMenu()`).
33
+ - **Home and End** in context menus, as in rdd.
34
+ - **`--vdd-context-menu-focus-ring`**: the outline on a menu item with keyboard focus, by default
35
+ `--vdd-focus-ring` (the skin's accent). Both are now documented in the theming chapter; they are
36
+ read with a fallback rather than declared, so they follow the skin's or your brand's accent.
37
+
38
+ ### Fixed
39
+
40
+ - **Menu items drew the browser's default focus ring** instead of the skin's.
41
+ - **ArrowUp from a menu with nothing highlighted would have gone to the second-to-last item**; it
42
+ goes to the last.
43
+
44
+ ### Upgrading
45
+
46
+ - Nothing to change for menus opened with the mouse or from script. If you open a menu from your
47
+ own keyboard shortcut, pass `initialFocus: 'first-item'` so it starts on an item.
48
+ - Tests that expected the first item to have focus right after `showContextMenu` should press
49
+ ArrowDown first, or open the menu with `initialFocus: 'first-item'`.
50
+
51
+ ### Tests
52
+
53
+ - `test/components/contextMenu.test.ts`: the menu itself is focused on open; `initialFocus`;
54
+ keyboard and mouse `contextmenu` events; ArrowDown/ArrowUp from the menu; Home and End. Each was
55
+ seen failing with its part of the fix removed.
56
+
57
+ ### Documentation
58
+
59
+ - Overlays chapter: initial focus, the option, keys, the focus ring. Theming chapter: a "Focus
60
+ rings" table with `--vdd-focus-ring` and `--vdd-context-menu-focus-ring`.
61
+
14
62
  ## [1.6.0] — 2026-10-04
15
63
 
16
64
  **Parity: react-dockable-desktop 7.5.0.** Toolbar buttons: the library sizes the icon inside its
@@ -46,7 +46,25 @@ export interface ShowContextMenuOptions {
46
46
  x?: number;
47
47
  y?: number;
48
48
  items: ContextMenuItem[];
49
+ /**
50
+ * Where focus goes when the menu opens. `'menu'` (the default) focuses the menu itself, with no
51
+ * item highlighted: ArrowDown then reaches the first item and ArrowUp the last. `'first-item'`
52
+ * focuses the first enabled item, for a menu opened from the keyboard. When this is left out, a
53
+ * keyboard `contextmenu` event (the ContextMenu key or Shift+F10, which report no pointer
54
+ * position) opens on the first item and everything else, including a call with no event, on
55
+ * the menu: the same view every time, whatever the user did before.
56
+ */
57
+ initialFocus?: 'menu' | 'first-item';
49
58
  }
59
+ /** A menu request as the workspace holds it. */
60
+ export interface ContextMenuRequest {
61
+ x: number;
62
+ y: number;
63
+ items: ContextMenuItem[];
64
+ initialFocus: 'menu' | 'first-item';
65
+ }
66
+ /** The menu's initial focus, from what the caller passed (see `ShowContextMenuOptions.initialFocus`). */
67
+ export declare function menuInitialFocus(options: ShowContextMenuOptions): 'menu' | 'first-item';
50
68
  export declare const isSeparator: (item: ContextMenuItem) => item is ContextMenuSeparator;
51
69
  export declare const isSubMenu: (item: ContextMenuItem) => item is ContextMenuSubMenu;
52
70
  /** Where a menu should open, from whatever the caller supplied. */
@@ -2,7 +2,7 @@ import type { App, Component, ComputedRef, InjectionKey } from 'vue';
2
2
  import type { DirtyStateOptions, DropPosition, FloatAnchor, FloatingWindow, Label, LayoutNode, MessageDescriptor, MessageFormatter, PanelInfo, SplitDirection } from '../types';
3
3
  import { PanelRegistry } from './registry';
4
4
  import type { PanelDefaultOptions } from './registry';
5
- import type { ContextMenuItem, ShowContextMenuOptions } from './contextMenu';
5
+ import type { ContextMenuItem, ContextMenuRequest, ShowContextMenuOptions } from './contextMenu';
6
6
  import type { BuiltInEvents } from './eventBus';
7
7
  import { defaultMessages } from './messages';
8
8
  import type { ToolbarState } from './toolbarState';
@@ -168,11 +168,7 @@ export interface Workspace<TEvents extends object = Record<string, unknown>> {
168
168
  /** Dismiss the open menu, if any. */
169
169
  closeContextMenu(): void;
170
170
  /** The pending menu request, or `null`. @internal */
171
- readonly contextMenu: ComputedRef<{
172
- x: number;
173
- y: number;
174
- items: ContextMenuItem[];
175
- } | null>;
171
+ readonly contextMenu: ComputedRef<ContextMenuRequest | null>;
176
172
  /**
177
173
  * Toolbar selection state, for items that are not controlled by the caller.
178
174
  *