Open Bug 1122965 Opened 9 years ago Updated 2 years ago

:hover pseudo-class doesn't work on ::before and ::after pseudo-elements

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

People

(Reporter: sebo, Unassigned)

References

(Blocks 1 open bug, )

Details

(Keywords: dev-doc-needed)

According to bug 922669 it should be possible to use the :hover pseudo-class on pseudo-elements. Though this doesn't seem to work.
It's possible for some pseudo-elements.  Specifically, the ones flagged with CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE in nsCSSPseudoElementList.h.  At the moment, that's just the HTML form control internal pseudo-elements.

See bug 922669 comment 3, in particular.

That said, the ::before and ::after do in fact have an Element associated with them, so I'm not sure why we can't support :hover there.  Cameron?
Flags: needinfo?(cam)
The needinfo was requested almost nine months ago. Cameron, can you provide the necessary info. If not, can you pass on the request to someone else?

Sebastian
I don't think Boris was asking for information; I think he was asking Cameron to do the work.
Summary: :hover pseudo-class doesn't work on pseudo-elements → :hover pseudo-class doesn't work on ::before and ::after pseudo-elements
Right.  (I'm taking the chance at the start of the quarter to go through my needinfo backlog so there's a greater chance of me getting to this soon.)
See Also: → 1299046
Blocks: css-pseudo-4
Once this is fixed, this should be documented at https://developer.mozilla.org/en-US/docs/Web/CSS/:hover, maybe also mentioned at https://developer.mozilla.org/en-US/docs/Web/CSS/::before and https://developer.mozilla.org/en-US/docs/Web/CSS/::after.

(In reply to Cameron McCormack (:heycam) from comment #4)
> Right.  (I'm taking the chance at the start of the quarter to go through my
> needinfo backlog so there's a greater chance of me getting to this soon.)

This "soon" is now already two and a half years long now. :-)

Sebastian
Keywords: dev-doc-needed
So, yes, I don't think there's any real reason we can't support this, and the Selectors spec does require it to be supported.  (On all pseudo-elements, actually.)  FWIW no other browser supports this yet.

Just adding CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE to the relevant entries in nsCSSPseudoElementList.h is insufficient, though, so perhaps there's something else in the mouse handling code that needs to be adjusted.
Flags: needinfo?(cam)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.