Closed Bug 656379 Opened 14 years ago Closed 14 years ago

CSS Hover and active should propagate from labels to the labeled content

Categories

(Core :: CSS Parsing and Computation, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla7

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(3 files)

We already do this for native theming; see bug 426082. Doing this makes it easier to fix bug 598833. The patches I attach will have a bug that's actually a bit of a pain to fix before bug 598833 lands: they won't handle dynamic removal/insertion of controls labeled by a currently hovered or active label well. I'll fix that in bug 656377.
Whiteboard: [need review]
Attachment #531829 - Flags: review?(Olli.Pettay) → review+
Comment on attachment 531830 [details] [diff] [review] part 2. Make labels expose a nicer API for getting their labeled content. > void > nsHTMLLabelElement::PerformAccesskey(PRBool aKeyCausesActivation, > PRBool aIsTrustedEvent) > { > if (!aKeyCausesActivation) { >- nsCOMPtr<nsIContent> content = GetControlContent(); >- if (content) >- content->PerformAccesskey(aKeyCausesActivation, aIsTrustedEvent); >+ Element* element = GetLabeledElement(); >+ if (element) >+ element->PerformAccesskey(aKeyCausesActivation, aIsTrustedEvent); { } And could you keep element strong here. So nsRefPtr<Element> element.
Attachment #531830 - Flags: review?(Olli.Pettay) → review+
> And could you keep element strong here. Done.
Comment on attachment 531831 [details] [diff] [review] part 3. Set :hover and :active state for labeled elements when their label has that state. r=dbaron
Attachment #531831 - Flags: review?(dbaron) → review+
Whiteboard: [need review] → [need landing]
Hello. Could anyone provide, if the case is, some simple STR or a test case to verify the issue?
data:text/html,<style>:hover { color: green; }</style><label for="x">Hover me</label><input id="x" value="I should turn green">
Thank you for the feedback. Mozilla/5.0 (Windows NT 6.1; rv:7.0) Gecko/20100101 Firefox/7.0 Mozilla/5.0 (X11; Linux i686; rv:7.0) Gecko/20100101 Firefox/7.0 Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0) Gecko/20100101 Firefox/7.0 Mozilla/5.0 (Windows NT 5.1; rv:7.0) Gecko/20100101 Firefox/7.0 Verified fixed on Ubuntu 11.04, Windows XP, Windows 7 and Mac OS 10.6 with test case provided in comment 10.
Status: RESOLVED → VERIFIED
Depends on: 710917
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: