Avoid using setTimout to check whether an autofilled value was cleared by a site immediately after the autofill action
Categories
(Toolkit :: Form Autofill, task, P3)
Tracking
()
People
(Reporter: janika, Unassigned)
References
Details
Bug 1955252 introduced heuristics to re-fill previously autofilled values when a website clears them immediately after autofill. This helps avoid cases where fields appear highlighted (as if filled - which they actually were previously) but remain visibly empty, which can confuse users.
To detect this behavior, we currently rely on a setTimeout with a 500ms delay to check whether a site cleared the autofilled value.
The challenge is that this clearing often happens silently—no DOM events are dispatched, and the value attribute on the HTML element isn't updated. So far, I haven’t found a reliable way to observe these changes:
- MutationObserver doesn’t detect them.
- EventListener callbacks aren't triggered.
- Even intercepting the value property via JavaScript (Object.defineProperty) or monkey-patching the element’s setter didn’t work in the observed cases.
My concern is that the current solution could feel glitchy to users. For ~500ms, they may see an empty yet highlighted field, only for it to be refilled moments later - this flicker can appear broken or jarring.
Updated•1 year ago
|
Description
•