fix(web): search-bar usability improvements (#24705)

* fix(search): improve search type dropdown accessibility and focus management

* fix(search): fix search options button accessibility position in search bar

* fix(search): removed unnecessary selection logic
This commit is contained in:
Luis Nachtigall
2025-12-19 15:59:41 +01:00
committed by GitHub
parent 138c9232df
commit a469e86b32

View File

@@ -308,18 +308,6 @@
/> />
</div> </div>
<div class="absolute inset-y-0 {showClearIcon ? 'end-14' : 'end-2'} flex items-center ps-6 transition-all">
<IconButton
aria-label={$t('show_search_options')}
shape="round"
icon={mdiTune}
onclick={onFilterClick}
size="medium"
color="secondary"
variant="ghost"
/>
</div>
{#if searchStore.isSearchEnabled} {#if searchStore.isSearchEnabled}
<div <div
id={searchTypeId} id={searchTypeId}
@@ -327,7 +315,7 @@
class:max-md:hidden={value} class:max-md:hidden={value}
class:end-28={value.length > 0} class:end-28={value.length > 0}
> >
<div class="relative"> <div class="relative" use:focusOutside={{ onFocusOut: closeSearchTypeDropdown }}>
<Button <Button
class="bg-immich-primary text-white dark:bg-immich-dark-primary/90 dark:text-black/75 rounded-full px-3 py-1 text-xs hover:opacity-80 transition-opacity cursor-pointer" class="bg-immich-primary text-white dark:bg-immich-dark-primary/90 dark:text-black/75 rounded-full px-3 py-1 text-xs hover:opacity-80 transition-opacity cursor-pointer"
onclick={toggleSearchTypeDropdown} onclick={toggleSearchTypeDropdown}
@@ -340,11 +328,11 @@
{#if showSearchTypeDropdown} {#if showSearchTypeDropdown}
<div <div
class="absolute top-full right-0 mt-1 bg-white dark:bg-immich-dark-gray border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg py-1 min-w-32 z-9999" class="absolute top-full right-0 mt-1 bg-white dark:bg-immich-dark-gray border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg py-1 min-w-32 z-9999"
use:focusOutside={{ onFocusOut: closeSearchTypeDropdown }}
> >
{#each searchTypes as searchType (searchType.value)} {#each searchTypes as searchType (searchType.value)}
<button <button
type="button" type="button"
tabindex="0"
class="w-full text-left px-3 py-2 text-xs hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors class="w-full text-left px-3 py-2 text-xs hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors
{currentSearchType === searchType.value ? 'bg-gray-100 dark:bg-gray-700' : ''}" {currentSearchType === searchType.value ? 'bg-gray-100 dark:bg-gray-700' : ''}"
onclick={() => selectSearchType(searchType.value)} onclick={() => selectSearchType(searchType.value)}
@@ -358,6 +346,18 @@
</div> </div>
{/if} {/if}
<div class="absolute inset-y-0 {showClearIcon ? 'end-14' : 'end-2'} flex items-center ps-6 transition-all">
<IconButton
aria-label={$t('show_search_options')}
shape="round"
icon={mdiTune}
onclick={onFilterClick}
size="medium"
color="secondary"
variant="ghost"
/>
</div>
{#if showClearIcon} {#if showClearIcon}
<div class="absolute inset-y-0 end-0 flex items-center pe-2"> <div class="absolute inset-y-0 end-0 flex items-center pe-2">
<IconButton <IconButton