{
event.stopPropagation();
closeDropdown();
},
},
]}
>
{#if isActive}
{/if}
{
openDropdown();
void incrementSelectedIndex(-1);
},
},
{
shortcut: { key: 'ArrowDown' },
onShortcut: () => {
openDropdown();
void incrementSelectedIndex(1);
},
},
{
shortcut: { key: 'ArrowDown', alt: true },
onShortcut: () => {
openDropdown();
},
},
{
shortcut: { key: 'Enter' },
onShortcut: () => {
if (selectedIndex !== undefined && filteredOptions.length > 0) {
onSelect(filteredOptions[selectedIndex]);
}
closeDropdown();
},
},
{
shortcut: { key: 'Escape' },
onShortcut: (event) => {
event.stopPropagation();
closeDropdown();
},
},
]}
/>
{#if selectedOption}
{:else if !isOpen}
{/if}
{#if isOpen}
{#if filteredOptions.length === 0}
- closeDropdown()}
>
{$t('no_results')}
{/if}
{#each filteredOptions as option, index (option.id || option.label)}
- onSelect(option)}
role="option"
>
{option.label}
{/each}
{/if}