From 12fb7df06847b2f5734e69832d753997e2437cfd Mon Sep 17 00:00:00 2001 From: Eva Marco Date: Wed, 25 Feb 2026 16:07:16 +0100 Subject: [PATCH] :bug: Intro doesn't trigger dropdown --- .../playwright/ui/specs/tokens/crud.spec.js | 2 +- .../ui/specs/tokens/remapping.spec.js | 2 +- .../app/main/ui/ds/buttons/icon_button.cljs | 4 +++- .../forms/controls/combobox_navigation.cljs | 19 +++++++------------ .../tokens/management/forms/generic_form.cljs | 18 +++++++++--------- 5 files changed, 21 insertions(+), 24 deletions(-) diff --git a/frontend/playwright/ui/specs/tokens/crud.spec.js b/frontend/playwright/ui/specs/tokens/crud.spec.js index f235a617e7..f51acf8676 100644 --- a/frontend/playwright/ui/specs/tokens/crud.spec.js +++ b/frontend/playwright/ui/specs/tokens/crud.spec.js @@ -37,7 +37,7 @@ test.describe("Tokens - creation", () => { const missingReferenceError = "Missing token references"; const { tokensUpdateCreateModal, tokenThemesSetsSidebar } = - await setupEmptyTokensFile(page , { + await setupEmptyTokensFileRender(page , { flags: ["enable-token-combobox", "enable-feature-token-input"], }); diff --git a/frontend/playwright/ui/specs/tokens/remapping.spec.js b/frontend/playwright/ui/specs/tokens/remapping.spec.js index b3e1e02cfc..4563b491b3 100644 --- a/frontend/playwright/ui/specs/tokens/remapping.spec.js +++ b/frontend/playwright/ui/specs/tokens/remapping.spec.js @@ -45,7 +45,7 @@ const createToken = async (page, type, name, textFieldName, value) => { const createTokenCombobox = async (page, type, name, textFieldName, value) => { const tokensTabPanel = page.getByRole("tabpanel", { name: "tokens" }); - const { tokensUpdateCreateModal } = await setupTokensFile(page, { + const { tokensUpdateCreateModal } = await setupTokensFileRender(page, { flags: ["enable-token-shadow"], }); diff --git a/frontend/src/app/main/ui/ds/buttons/icon_button.cljs b/frontend/src/app/main/ui/ds/buttons/icon_button.cljs index 3d766db460..1615ed9b0d 100644 --- a/frontend/src/app/main/ui/ds/buttons/icon_button.cljs +++ b/frontend/src/app/main/ui/ds/buttons/icon_button.cljs @@ -17,6 +17,7 @@ [:map [:class {:optional true} :string] [:tooltip-class {:optional true} [:maybe :string]] + [:type {:optional true} [:maybe [:enum "button" "submit" "reset"]]] [:icon-class {:optional true} :string] [:icon [:and :string [:fn #(contains? icon-list %)]]] @@ -29,7 +30,7 @@ (mf/defc icon-button* {::mf/schema schema:icon-button ::mf/memo true} - [{:keys [class icon icon-class variant aria-label children tooltip-placement tooltip-class] :rest props}] + [{:keys [class icon icon-class variant aria-label children tooltip-placement tooltip-class type] :rest props}] (let [variant (d/nilv variant "primary") @@ -47,6 +48,7 @@ props (mf/spread-props props {:class [class button-class] + :type (d/nilv type "button") :aria-labelledby tooltip-id})] [:> tooltip* {:content aria-label diff --git a/frontend/src/app/main/ui/workspace/tokens/management/forms/controls/combobox_navigation.cljs b/frontend/src/app/main/ui/workspace/tokens/management/forms/controls/combobox_navigation.cljs index 6e16d992b7..b8be6dad81 100644 --- a/frontend/src/app/main/ui/workspace/tokens/management/forms/controls/combobox_navigation.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/management/forms/controls/combobox_navigation.cljs @@ -84,9 +84,9 @@ enter? (do - (dom/prevent-default event) (when (and is-open focused-id) (let [focusables (focusable-options options)] + (dom/prevent-default event) (when (some #(= (:id %) focused-id) focusables) (on-enter focused-id))))) esc? @@ -98,10 +98,12 @@ ;; Initial focus on first option (mf/with-effect [is-open options] (when is-open - (let [options (if (delay? options) @options options) - focusables (focusable-options options) - first-id (some :id focusables)] - (reset! focused-id* first-id)))) + (let [opts (if (delay? options) @options options) + focusables (focusable-options opts) + ids (set (map :id focusables))] + (when (and (seq focusables) + (not (contains? ids focused-id))) + (reset! focused-id* (:id (first focusables))))))) ;; auto scroll when key down (mf/with-effect [focused-id nodes-ref] @@ -113,12 +115,5 @@ node {:block "nearest" :inline "nearest"}))))) - (mf/with-effect [is-open options] - (when is-open - (let [opts (if (delay? options) @options options) - focusables (focusable-options opts) - first-id (some :id focusables)] - (reset! focused-id* first-id)))) - {:focused-id focused-id :on-key-down on-key-down})) \ No newline at end of file diff --git a/frontend/src/app/main/ui/workspace/tokens/management/forms/generic_form.cljs b/frontend/src/app/main/ui/workspace/tokens/management/forms/generic_form.cljs index 4d15d4ca9a..8225a52887 100644 --- a/frontend/src/app/main/ui/workspace/tokens/management/forms/generic_form.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/management/forms/generic_form.cljs @@ -250,15 +250,15 @@ :trim true :auto-focus true}]] - [:div {:class (stl/css :input-row)} - (case value-type - :indexed - [:> input-component - {:token token - :tokens tokens - :tab active-tab - :value-subfield value-subfield - :handle-toggle on-toggle-tab}] + [:div {:class (stl/css :input-row)} + (case value-type + :indexed + [:> input-component + {:token token + :tokens tokens + :tab active-tab + :value-subfield value-subfield + :handle-toggle on-toggle-tab}] :composite [:> input-component