Skip to content

[PM-38025] Filter inline autofill menu items as the user types#20836

Open
xrvk wants to merge 2 commits into
bitwarden:mainfrom
xrvk:xrvk/ubiquitous-system
Open

[PM-38025] Filter inline autofill menu items as the user types#20836
xrvk wants to merge 2 commits into
bitwarden:mainfrom
xrvk:xrvk/ubiquitous-system

Conversation

@xrvk
Copy link
Copy Markdown

@xrvk xrvk commented May 24, 2026

🎟️ Tracking

Community feature request (52 replies, ~1.3k views): https://community.bitwarden.com/t/inline-autofill-menu-ability-to-filter-items-by-typing-searching/63417

📔 Objective

When the inline autofill menu is open and the user starts typing in a username/email field, the menu closes today (see triggerFormFieldInput -> closeAutofillInlineMenu). For users with several saved logins on the same site this means scrolling instead of narrowing. This PR keeps the menu open on login text fields and filters the cipher list using the typed text. The focused input field itself acts as the search box, so no new UI is added.

Behavior on password, TOTP, card, and identity fields is preserved unchanged (still close-on-type). The filter is reset whenever the inline menu closes, focus moves to a different field, or the vault refreshes, and it is treated as PII (never logged, length-capped).

Changes:

  • autofill-overlay-content.service.ts: triggerFormFieldInput branches on inlineMenuFillType. For login text-like fields (CipherType.Login, InlineMenuFillTypes.AccountCreationUsername, excluding password/TOTP) it sends a new updateAutofillInlineMenuFilter message and keeps the menu open. All other field types use the existing close path bit-for-bit.
  • overlay.background.ts: new inlineMenuFilter field, new updateAutofillInlineMenuFilter extension-message handler, and filter application via the existing SearchService.searchCiphersBasic before cipher projection. The filtered set flows through the existing updateAutofillInlineMenuListCiphers port message (no new ports).
  • autofill-inline-menu-list.ts: accepts an optional filter and, when the resulting cipher list is empty, renders a localized "No matches for $FILTER$" empty state. The filter value is inserted as a text node so it cannot be interpreted as HTML.
  • New i18n key inlineMenuNoMatches in _locales/en/messages.json.
  • main.background.ts: passes SearchService to OverlayBackground (already initialized earlier in the DI graph).

No new permissions, no manifest changes, no new ports, no new event listeners. The implementation reuses existing plumbing that already works on Chrome, Firefox, and Safari. Ten new unit tests were added covering filter apply, reset on close/focus-change/vault refresh, non-searchable short-circuit, dedup, length cap, the iframe empty state, an XSS guard on the filter text-node insertion, and regression guards confirming password/card/identity still close on type. All 1766 autofill tests pass.

📸 Screenshots


Consolidation with PR #20543

After this PR was opened, we discovered that PR #20543 (Add filter-as-you-type to autofill inline menu, Gamerhund, opened 2026-05-07) already addresses the same feature and has been forwarded to internal teams by audreyality. To minimize churn and align with the prior art that is already in front of reviewers, this PR has been updated to:

Adopted from #20543 (their wire-protocol naming):

  • Message command: filterInlineMenuCiphers (was updateAutofillInlineMenuFilter)
  • Wire payload field: filterValue (was filter)

Retained from this PR (engineering differentials worth keeping):

  • SearchService.searchCiphersBasic reuse instead of duplicating an inline lowercase-substring match. Picks up URI and notes matching for free and centralizes search logic.
  • Field-type guard in triggerFormFieldInput: only login text fields (CipherType.Login, InlineMenuFillTypes.AccountCreationUsername, excluding password/TOTP) stream the filter. Password keystrokes never traverse the message bus. Card and identity fields keep their existing click-to-fill behavior.
  • PII handling: filter value is length-capped, never logged, and explicitly documented as PII.
  • Explicit reset hooks: filter resets on inline-menu close, focus-change to a different field, and full vault refresh.
  • Localized "No matches" empty state in the iframe (new i18n key inlineMenuNoMatches), rendered with text nodes for XSS safety. Preferred over silently closing the menu on zero matches because it tells the user their query simply didn't match — backspacing restores the list without the menu disappearing and re-appearing.
  • Regression-guard tests: explicit assertions that password / card / identity fields still close-on-type.

Deliberately not adopted from #20543:

  • Auto-reopen on filter when the menu is closed. We treat an explicit close (Escape, blur, etc.) as user intent and do not re-open the menu just because the user typed another character. This may be revisited based on review feedback.
  • Close-on-zero-matches. The localized empty state is the alternative chosen here.

If the team prefers #20543 as the basis, the wire-protocol naming now matches verbatim, so cherry-picking the differentials above is a small diff.

Keep the inline autofill menu open while the user types in a username/
email/login text field and filter the cipher list using the field's
value via SearchService.searchCiphersBasic. The user's own input field
acts as the search box — no extra search input is introduced.

Behavior is preserved bit-for-bit for password, TOTP, card, and
identity fields, which continue to close the menu on type as before
(regression-guard tests added).

The typed filter is treated as PII: never logged, length-capped, reset
on inline-menu close, focus-change to a different field, and full
vault refresh.

Community request:
https://community.bitwarden.com/t/inline-autofill-menu-ability-to-filter-items-by-typing-searching/63417

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@xrvk xrvk requested a review from a team as a code owner May 24, 2026 21:01
@xrvk xrvk requested a review from jprusik May 24, 2026 21:01
@bitwarden-bot
Copy link
Copy Markdown
Collaborator

Thank you for your contribution! We've added this to our internal tracking system for review.
ID: PM-38025
Link: https://bitwarden.atlassian.net/browse/PM-38025

Details on our contribution process can be found here: https://contributing.bitwarden.com/contributing/pull-requests/community-pr-process.

@bitwarden-bot bitwarden-bot changed the title Filter inline autofill menu items as the user types [PM-38025] Filter inline autofill menu items as the user types May 24, 2026
@bitwarden-bot bitwarden-bot added community-pr needs-qa Marks a PR as requiring QA approval labels May 24, 2026
@xrvk xrvk changed the title [PM-38025] Filter inline autofill menu items as the user types Filter inline autofill menu items as the user types May 24, 2026
@xrvk xrvk changed the title Filter inline autofill menu items as the user types [PM-38025] Filter inline autofill menu items as the user types May 24, 2026
@pamperer562580892423
Copy link
Copy Markdown

pamperer562580892423 commented May 24, 2026

Only another user here... but as I saw it... just FYI, someone else opened a similar PR recently: #20543

Rename the new message and wire field to match the names already in front
of maintainers on PR bitwarden#20543 (filterInlineMenuCiphers / filterValue), so
the two PRs use compatible protocols and cherry-picking between them is
trivial.

- updateAutofillInlineMenuFilter -> filterInlineMenuCiphers (message)
- filter -> filterValue (payload field)
- inlineMenuFilter -> inlineMenuFilterValue (internal field)

No behavior change. All 1766 autofill tests still pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-pr needs-qa Marks a PR as requiring QA approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants