bitwarden / bitwarden/clients

Autofill performance regression, even when autofill is disabled

Open
#20,107 11 comments 9 reactions 0 assignees View on GitHub
browser bug
Dominant language
TypeScript
Stars
13.8k
Forks
2k
Avg merge
3d 15h
Merged PRs (30d)
389

Description

### Summary

The autofill performance degradation from https://github.com/bitwarden/clients/issues/17090 has returned in 2026.3.0.

It originally showed up in 2025.10.0 and was fixed in 2025.12.0, and 2026.2.0 still seems good too. AFAIK the problem was introduced in 6129ca5366 and related to component-heavy sites using many shadow DOMs, and this commit was reverted in c04c1757ea for the fix.

I see there was some recent work around shadow DOMs again in f9dff532a6, along with performance specs, and while it does seem a bit less egregious than last time it's still very noticeable for me in the form of cursor lag on sites like YouTube or Reddit.

### Steps To Reproduce

Example 1:

1. Go to https://www.youtube.com/
2. Focus the search field and hold down a key, e.g. `i`
3. Observe the input lagging every second or so

Example 2:

1. Go to a random YouTube video
2. Move the mouse over the timeline to show the preview images
3. Observe the preview images lagging every second or so

Note: you might need to test on an older machine or throttle your CPU to see this

### Expected Result

The autofill code shouldn't degrade performance.

What really bugs me is that I don't even use autofill:

- "Show autofill suggestions on form fields" is disabled
- "Autofill on page load" is disabled

So it would be really neat if the extension could not run these expensive autofill watchers at all in this case.

I do use the fill keyboard shortcut and filling from the extension window, but surely the extension could just find the form fields **once** when those actions are triggered?

### Actual Result

The autofill code introduces lags.

### Screenshots or Videos

Firefox profile: https://share.firefox.dev/41tdVUx

The offending call stack looks similar as in https://github.com/bitwarden/clients/issues/17090#issuecomment-3470662755:

```
nodeIsElement [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://:5148:23]
getShadowRoot [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://:8878:18]
buildTreeWalkerNodesQueryResults [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://:8920:37]
queryAllTreeWalkerNodes [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://:8905:28]
query [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://:8766:10]
queryAutofillFormAndFieldElements [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://:22231:38]
getPageDetails/< [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://:21660:89]
InterpretGeneratorResume [self-hosted:1312:34]
next [self-hosted:1233:23]
collect_autofill_content_service_awaiter:21349:46]
collect_autofill_content_service_awaiter< [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://:21347:95]
getPageDetails [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://:21659:19]
requestIdleCallbackPolyfill/< [Extension "Bitwarden Password Manager" (ID: {446900e4-71c2-419f-a6a7-df9c091e268b}): moz-extension://:4937:47]
requestIdleCallback handler
```

### Operating System

Linux

### Web Browser

Firefox

### Browser Version

149.0.2

### Environment Versions

Version: 2026.3.0

SDK: 'main (7637fdf)'

Server version: 2026.3.2

### Issue Tracking Info

- [x] I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress.

Contributor guide

Open the contributing guide

Research direction

Reproduce the lag on Firefox with autofill suggestions and page-load autofill disabled, using the YouTube steps and the supplied call stack as the starting point. Trace getPageDetails through queryAutofillFormAndFieldElements and compare the shadow-DOM changes in f9dff532a6 with the reverted fix in c04c1757ea, then run the mentioned performance specs. Done means disabled autofill no longer causes noticeable page lag while keyboard and extension-window filling still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.