|
43 | 43 | $: watchOpen(open); |
44 | 44 | $: watchEntries(entries); |
45 | 45 | $: watchRemeasureWidth(filteredEntries, drawIcon); |
46 | | - $: watchHighlightedWithSearch(filteredEntries, open); |
| 46 | + // $: watchHighlightedWithSearch(filteredEntries, open); |
47 | 47 |
|
48 | 48 | $: filteredEntries = entries.map((section) => section.filter((entry) => inSearch(search, entry))); |
49 | 49 | $: virtualScrollingTotalHeight = filteredEntries.length === 0 ? 0 : filteredEntries[0].length * virtualScrollingEntryHeight; |
|
69 | 69 | } |
70 | 70 |
|
71 | 71 | // Required to keep the highlighted item centered and to find a new highlighted item if necessary |
72 | | - async function watchHighlightedWithSearch(filteredEntries: MenuListEntry[][], open: boolean) { |
73 | | - if (highlighted && open) { |
74 | | - // Allows the scrollable area to expand if necessary |
75 | | - await tick(); |
76 | | -
|
77 | | - const flattened = filteredEntries.flat(); |
78 | | - const highlightedFound = highlighted?.label && flattened.map((entry) => entry.label).includes(highlighted.label); |
79 | | - const newHighlighted = highlightedFound ? highlighted : flattened[0]; |
80 | | - setHighlighted(newHighlighted); |
81 | | - } |
82 | | - } |
| 72 | + // async function watchHighlightedWithSearch(filteredEntries: MenuListEntry[][], open: boolean) { |
| 73 | + // if (highlighted && open) { |
| 74 | + // // Allows the scrollable area to expand if necessary |
| 75 | + // await tick(); |
| 76 | +
|
| 77 | + // const flattened = filteredEntries.flat(); |
| 78 | + // const highlightedFound = highlighted?.label && flattened.map((entry) => entry.label).includes(highlighted.label); |
| 79 | + // const newHighlighted = highlightedFound ? highlighted : flattened[0]; |
| 80 | + // setHighlighted(newHighlighted); |
| 81 | + // } |
| 82 | + // } |
83 | 83 |
|
84 | 84 | // Detect when the user types, which creates a search box |
85 | 85 | async function startSearch(e: KeyboardEvent) { |
|
0 commit comments