Bug 1904593, don't clear the autofill state when modified by script, r=dom-core,credential-management-reviewers,dimi,sefeng

It turns out that many sites are modifying the field state immediately after a value has been autofilled, typically to format the value such as add spaces between parts of a credit card number

Differential Revision: https://phabricator.services.mozilla.com/D215113
This commit is contained in:
Neil Deakin
2024-07-22 14:33:14 +00:00
parent 94cf306e19
commit c18a0f1d1f
2 changed files with 3 additions and 2 deletions

View File

@@ -7057,7 +7057,8 @@ void HTMLInputElement::OnValueChanged(ValueChangeKind aKind,
if (aKind != ValueChangeKind::Internal) {
mLastValueChangeWasInteractive = aKind == ValueChangeKind::UserInteraction;
if (State().HasState(ElementState::AUTOFILL)) {
if (mLastValueChangeWasInteractive &&
State().HasState(ElementState::AUTOFILL)) {
RemoveStates(ElementState::AUTOFILL | ElementState::AUTOFILL_PREVIEW);
}
}