Hover/active quirk doesn't account properly for `:is()` / `:where()`
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox126 | --- | verified |
People
(Reporter: sebo, Assigned: nielsekkelenkamp, Mentored)
References
(
URL
)
Details
(Keywords: good-first-bug, Whiteboard: [lang=rust])
Attachments
(3 files, 1 obsolete file)
The :is() pseudo-class currently doesn't match form elements when followed by a :hover or :active pseudo-class.
I didn't try all combinations, though it does work for other pseudo-classes like :focus, :focus-within or :first-child.
And this issue also seems to be restricted to form fields. Other elements like anchors work fine. Though again, I didn't test all of them.
STR:
- Go to
data:text/html,<button>Button</button><input value="Input"><a href="">Link</a><style>:is(button,input,a){background-color:yellow;}:is(button,input,a):hover{background-color:lime;}:is(button,input):focus{background-color:skyblue;}</style> - Hover the button or the input field
Actual:
The fields still have a yellow background on hover (bug), while the anchor gets a lime background on hover (ok).
Expected:
The fields should get a lime background on hover like the anchor.
I tested this with Firefox 118.0, Nightly 120.0a1 (2023-10-01) and also Firefox 100.0 and 78.0 (where :is() got released) and they all have the same issue. So it is not a regression.
Sebastian
Comment 1•2 years ago
|
||
Comment 2•2 years ago
|
||
Comment 3•2 years ago
|
||
I guess this is https://quirks.spec.whatwg.org/#the-active-and-hover-quirk.
This code isn't recursing into nested selectors etc.
We should just add Is / Where / Has and other pseudo-classes that aren't a NonTSPseudoClass to that match statement (might be easier to invert the statement actually, since any new thing we probably don't want to apply the quirk to...).
We should extend test_hover_quirk for this.
Updated•2 years ago
|
Hi, I'd like to start working on fixing this bug. This would be my first bug for the mozilla codebase.
If I understand correctly, Is / Where / Has and other pseudo-classes that aren't a NonTSPseudoClass should be added to the match statement, returning true in those cases. Or it should be inverted, returning true on those cases, pseudo_class.is_active_or_hover() for NonTSPseudoClass and false for the rest.
Updated•2 years ago
|
I added Is / Where / Has and any other pseudo classes or elements i could find in Component.
I took a look at test_hover_quirk and I wouldn't know how to go about extending the actual test. It seems to want to run the tests from a SimpleTest file that doesn't exist.
I also looked at trying to invert the statement, where it would just return false on any case that's not a NonTSPseudoClass but I'm not certain about doing it this way since I'm not sure if there were ever any cases where the current statement ends in the _ => true.
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 9•2 years ago
|
||
| bugherder | ||
Updated•2 years ago
|
Comment 10•2 years ago
|
||
I've reproduced this issue using Nightly 125.0a1 on Windows10 x64 following the STR from Comment 0.
Verified as fixed in the latest Firefox 126.0b3 version on Windows10 x64, macOS 13 and Ubuntu 22.04, as the issue no longer persists.
Updated•2 years ago
|
Description
•