From f32f31a57aa6fbea7e59dd74dfd2de06223b9efe Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Tue, 13 Oct 2026 18:49:49 -0700 Subject: [PATCH] Navigate menus with the arrow keys alongside the pointer, and make Tab move only between text fields (#4691) * Navigate menus with the arrow keys alongside the pointer, across submenus and the menu bar * Keep a submenu open while the pointer crosses other menu entries on its way into it * Make Tab move only between text fields and stop drawing focus outlines on other elements * Code review fix: stop Tab from moving the focus before the key handler waits --- .../utility_types/widgets/input_widgets.rs | 2 - frontend/src/components/Editor.svelte | 48 +- .../components/floating-menus/MenuList.svelte | 805 +++++++++++------- .../src/components/layout/FloatingMenu.svelte | 4 - frontend/src/components/panels/Layers.svelte | 2 - .../src/components/widgets/NodeSection.svelte | 1 - .../src/components/widgets/WidgetSpan.svelte | 3 +- .../widgets/buttons/IconButton.svelte | 1 - .../buttons/ParameterExposeButton.svelte | 1 - .../widgets/buttons/TextButton.svelte | 16 +- .../widgets/inputs/CheckboxInput.svelte | 2 - .../widgets/inputs/ColorInput.svelte | 2 +- .../widgets/inputs/ColorPresetsInput.svelte | 16 +- .../widgets/inputs/DropdownInput.svelte | 90 +- .../widgets/inputs/MathExpressionInput.svelte | 5 + .../widgets/inputs/NumberInput.svelte | 5 - .../widgets/inputs/RadioInput.svelte | 1 - .../widgets/inputs/ReferencePointInput.svelte | 18 +- .../widgets/inputs/ScrollbarInput.svelte | 4 +- .../widgets/inputs/WorkingColorsInput.svelte | 4 +- frontend/src/managers/input.ts | 2 - frontend/src/stores/dropdown-menus.ts | 10 + frontend/src/utility-functions/input.ts | 75 +- 23 files changed, 627 insertions(+), 490 deletions(-) diff --git a/editor/src/messages/layout/utility_types/widgets/input_widgets.rs b/editor/src/messages/layout/utility_types/widgets/input_widgets.rs index 97b8c97b2d..de110754aa 100644 --- a/editor/src/messages/layout/utility_types/widgets/input_widgets.rs +++ b/editor/src/messages/layout/utility_types/widgets/input_widgets.rs @@ -85,8 +85,6 @@ pub struct DropdownInput { // Behavior #[serde(rename = "virtualScrolling")] pub virtual_scrolling: bool, - #[derivative(Default(value = "true"))] - pub interactive: bool, // Set along with the `on_file_drop` callback #[serde(rename = "takesFileDrop")] #[widget_builder(skip)] diff --git a/frontend/src/components/Editor.svelte b/frontend/src/components/Editor.svelte index 484edc6e7e..92f4d471c9 100644 --- a/frontend/src/components/Editor.svelte +++ b/frontend/src/components/Editor.svelte @@ -293,51 +293,9 @@ } } - // List of all elements that should show an outline when focused by tabbing or by clicking the element - .dropdown-input .dropdown-box, - .font-input .dropdown-box { - &:focus { - outline: 1px dashed var(--color-e-nearwhite); - outline-offset: -1px; - } - } - - // List of all elements that should show an outline when focused by tabbing, but not by clicking the element - .icon-button, - .text-button, - .popover-button, - .color-input > button, - .color-picker .preset-color, - .working-colors-input .swatch > button, - .radio-input button, - .menu-list, - .menu-list-button .entry, - .layer-tree .expand-arrow, - .node-section .header { - &:focus-visible { - outline: 1px dashed var(--color-e-nearwhite); - outline-offset: -1px; - } - - // Variant: dark outline over light colors - &.preset-color.white, - &.text-button.emphasized { - &:focus-visible { - outline: 1px dashed var(--color-2-mildblack); - } - } - } - - // Checkbox needs to apply the focus outline to its sibling label - .optional-input input:focus-visible + label, - .checkbox-input input:focus-visible + label { - outline: 1px dashed var(--color-e-nearwhite); - outline-offset: -1px; - } - - // Variant: dark outline over light colors (when the checkbox is checked) - :not(.optional-input) > .checkbox-input input:focus-visible + label.checked { - outline: 1px dashed var(--color-2-mildblack); + // The browser's focus ring is left off since the keyboard only moves between text fields, whose focus styles are their own + :where(:focus-visible) { + outline: none; } @font-face { diff --git a/frontend/src/components/floating-menus/MenuList.svelte b/frontend/src/components/floating-menus/MenuList.svelte index 6e3d75c7b6..7c10a7d8bc 100644 --- a/frontend/src/components/floating-menus/MenuList.svelte +++ b/frontend/src/components/floating-menus/MenuList.svelte @@ -1,9 +1,10 @@
- +
- +