From b645871dbcb8e654f86e7db39f76c7b4595c14b8 Mon Sep 17 00:00:00 2001 From: Hemu <1871299+hemu@users.noreply.github.com> Date: Sun, 7 Jun 2026 20:53:58 -0400 Subject: [PATCH] Fix duplicated dropdown selection styling when multiple entries have identical labels (#4180) * Fix dropdown select if options have identical labels * update other uses of label in favor of value * simplify null checks --- frontend/src/components/floating-menus/MenuList.svelte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/floating-menus/MenuList.svelte b/frontend/src/components/floating-menus/MenuList.svelte index 1a8e0279a6..09dcb5664c 100644 --- a/frontend/src/components/floating-menus/MenuList.svelte +++ b/frontend/src/components/floating-menus/MenuList.svelte @@ -97,7 +97,7 @@ await tick(); const flattened = filteredEntries.flat(); - const highlightedFound = highlighted?.label && flattened.map((entry) => entry.label).includes(highlighted.label); + const highlightedFound = flattened.map((entry) => entry.value).includes(highlighted.value); const newHighlighted = highlightedFound ? highlighted : flattened[0]; setHighlighted(newHighlighted); } @@ -335,7 +335,7 @@ if ((menuOpen || interactive) && (e.key === "ArrowUp" || e.key === "ArrowDown")) { let newIndex = e.key === "ArrowUp" ? flatEntries.length - 1 : 0; if (highlighted) { - const index = highlighted ? flatEntries.map((entry) => entry.label).indexOf(highlighted.label) : 0; + const index = flatEntries.map((entry) => entry.value).indexOf(highlighted.value); newIndex = index + (e.key === "ArrowUp" ? -1 : 1); // Interactive dropdowns should lock at the end whereas other dropdowns should loop @@ -482,7 +482,7 @@ {#each currentEntries(section, virtualScrollingEntryHeight, virtualScrollingStartIndex, virtualScrollingEndIndex, search) as entry, entryIndex (entryIndex + startIndex)}