fix: stop Bitwarden offering logins in the mail search box

This commit is contained in:
Linus Rath
2026-10-11 20:49:37 +02:00
parent 8c7758b2f1
commit f382568d1d
2 changed files with 13 additions and 2 deletions
@@ -194,3 +194,11 @@ describe('SearchBox suggestions (#845)', () => {
expect(screen.queryByRole('listbox')).toBeNull();
});
});
describe('SearchBox and password managers', () => {
it('is a search field, which Bitwarden never offers to fill', () => {
// data-bwignore only works when the user opted in to it in Bitwarden.
render(<Harness />);
expect(input()).toHaveAttribute('type', 'search');
});
});
+5 -2
View File
@@ -118,8 +118,11 @@ export function SearchBox({ value, onChange, onSubmit, onClear, onSelectContact,
className="relative"
>
<Search className="absolute start-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground" />
{/* type="search": Bitwarden skips search fields unconditionally (it
honours data-bwignore only when the user opted in) and otherwise
offered logins here. */}
<Input
type="text"
type="search"
autoFocus={autoFocus}
placeholder={t("search_placeholder_hint")}
value={value}
@@ -137,7 +140,7 @@ export function SearchBox({ value, onChange, onSubmit, onClear, onSelectContact,
close();
}}
onKeyDown={handleKeyDown}
className={cn("ps-9 h-9", value && "pe-8")}
className={cn("ps-9 h-9 [&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none", value && "pe-8")}
role="combobox"
aria-expanded={showDropdown}
aria-controls={listId}