Open Bug 1755912 Opened 1 year ago Updated 1 year ago

[US][] Autofill is no longer working after using the clear form option


(Toolkit :: Form Autofill, defect, P3)




Tracking Status
firefox97 --- affected
firefox98 --- affected
firefox99 --- affected


(Reporter: alin.ilea, Unassigned)


(Blocks 2 open bugs, )



(2 files)

Attached video

Affected Versions:

Nightly 99.a1, Beta 98 and Release 97

Tested on:

MacOS 11
Windows 10

Preconditions: US
extensions.formautofill.addresses.enabled - true
extensions.formautofill.addresses.supported to "detect"
extensions.formautofill.addresses.supportedCountries US,CA
download latest Firefox Nightly with region locale
have a complete address already saved in about:preferences#privacy

Steps to reproduce:

  1. Reach the address form on
  2. Using the autofill feature, select 1 saved address entry.
  3. Click in any auto-filled field in order to clear the form by using the autofill dropdown option.

Expected Results:

  1. Autofill should work accordingly after clearing the form using the "Clear Form" option.
  2. The preview should be compatible with the field placeholders without overlapping each other.

Actual Results:

  1. Autofill is no longer working after using the clear form option.
  2. Address autofill preview overlaps with field placeholder (see comment 1).


Reproducible on Chrome: 1. No, 2. Yes
Please let me know if a separate bug is needed for the second issue (Address autofill preview overlaps with field placeholder) and I'll file a new one for that.

Attached image 2022-02-17_15h27_24.png
Flags: needinfo?(tgiles)

Ah okay, I think I know what's going on. So before filling the form, the form has a City and State field. After filling however, these two fields get condensed into one select element, based on the ZIP Code field. When we go to clear the form, we appear to clear everything except this combined City, State select element. However the selected element in first in the list, so we don't reset the select element. The element in order to "correctly" reset the form is the last element in the select element, an option with the "Other" value. If one selects the "other" value, then the select element separates itself back into two separate city and state inputs and allows autofill to occur again.

Here's why the autocomplete dropdown doesn't appear after clearing: the current form has already been populated and the field is not an empty credit card field. Since there is still user filled data in the form, we don't clear the filledRecordGUID which causes us to go down the form history branch, which prevents the autocomplete results from appearing as expected.

I think there are some other issues with our autocomplete handling on this page however, we seem to call _fillFromAutocompleteRow() when we clear the form, which doesn't make a lot of sense to me. Clearing the form causes the "FormAutoComplete:HandleEnter" message to be sent but this appears to be expected due to clear form being an option in the autocomplete dropdown menu (I think? I'm not entirely sure about this anymore). I guess the more unexpected part is, why is the "autocomplete-will-enter-text" topic being observed when a form is being cleared? Hmm, this previously stated pattern seems to happen even on sites where the clear form functionality works as expected (i.e. I don't think that's an additional culprit.

Something else I noticed is that we're not clearing the styles on the Country/Region input after clearing the form. This, to me, implies we're not changing the state of this field correctly and that might be what's causing this issue. It's odd that splitting the City and State fields causes autofill to work again (sometimes, the form can get into an odd state still) but the Country/Region field is still highlighted as if it was autofilled until one previews another autocomplete result.

Flags: needinfo?(tgiles)
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.