Open Bug 1923525 Opened 2 years ago Updated 6 months ago

CSS :autofill pseudo-class is not working for form-history filling

Categories

(Toolkit :: Autocomplete, defect)

Firefox 131
defect

Tracking

()

People

(Reporter: zozuliak, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:131.0) Gecko/20100101 Firefox/131.0

Steps to reproduce:

Go to https://developer.mozilla.org/en-US/docs/Web/CSS/:autofill
Scroll down to Try It section
Try picking any autofill values that browser suggests

Actual results:

The CSS styles for :autfill pseudo class aren't applied - look at attached screenshot, notice no orange border around the input

Calling .match(":autofill") on the element returns false

Expected results:

The CSS styles for :autfill pseudo class are applied - this works well in Chrome and Safari

Calling .match(":autofill") on the element returns true

Summary: Autofill pseudo class is not working → CSS Autofill pseudo class is not working

The Bugbug bot thinks this bug should belong to the 'Core::CSS Parsing and Computation' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core

Did this work in earlier Firefox versions? If so, using mozregression to identify when it broke would be really helpful.

Flags: needinfo?(zozuliak)

So MDN says :autofill is fully supported starting from Firefox version 86. I have downloaded 86 for Mac and can confirm it actually doesn't work there. Then 86 automatically updated to 109 and :autofill doesn't work there either. It seems like this has never really worked although it was officially shipped.

Related links:

Flags: needinfo?(zozuliak)

Yeah, it doesn't appear to work for me on the MDN examples either. But does work in some other cases; e.g. I used the Inspector to add an :autofill rule to the amazon.co.uk login page, and that worked as expected when Firefox filled in my email.

So I think this is an issue of exactly when the browser considers the field to be "auto-filled" vs "set by the user". Emilio, do you know more about what's involved here?

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(emilio)
Summary: CSS Autofill pseudo class is not working → CSS :autofill pseudo-class is not working

Yeah, autofill matches only with user / password / etc autofill.

E.g. if you go here, everything that becomes yellow when you fill a login matches :autofill.

It's unclear if we should consider the other form filling stuff as autofill, Dimi wdyt?

Flags: needinfo?(emilio) → needinfo?(dlee)
Summary: CSS :autofill pseudo-class is not working → CSS :autofill pseudo-class is not working for form-history filling

Other major browsers, Chrome and Safari, consider it autofill when user selects from prompt which comes from autocomplete input functionality.

More over, the spec itself mentions it:

https://html.spec.whatwg.org/multipage/semantics-other.html#selector-autofill

One way such autofilling might happen is via the autocomplete attribute, but user agents could autofill even without that attribute being involved.

So I think Firefox actually should consider autocomplete as autofill

Component: CSS Parsing and Computation → Autocomplete
Product: Core → Toolkit

Not opposed to making that change. The toolkit code is what manages this and should set the pseudo-class.

(In reply to Emilio Cobos Álvarez (:emilio) from comment #5)

It's unclear if we should consider the other form filling stuff as autofill, Dimi wdyt?

Yes, I agree this should be considered as autofill. Currently, there are discrepancies in how we display autofill or preview states across form history, login, address, and credit card modules. We plan to unify the behavior across all these modules, and this is included in our roadmap. This issue will be addressed as part of that unification work.

Flags: needinfo?(dlee)
Blocks: 2039611
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: