Re: :hover and :active interaction with labels

On May 9, 2011, at 8:45 PM, Boris Zbarsky wrote:

> Consider this testcase:
> 
>  <!DOCTYPE html>
>  <style>
>    input { color: black; }
>    input:hover { color: white; }
>  </style>
>  <label for="x">Hover me</label>
>  <input id="x" type="button" value="A button">
> 
> Observed behavior in browsers is that hovering the label puts the button into :hover state in WebKit but not in Gecko, Presto, or Trident. Similar for :active.
> 
> However for controls that have native themed hover/active state, at least Gecko and Trident _do_ put the control into that native themed state when the label is hovered or activated.  They just don't change the actual CSS-exposed :hover and :active state.
> 
> See discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=426082 where we implemented the current Gecko behavior.
> 
> I would like to change the Gecko behavior here to match WebKit's, both because it would eliminate this weird dichotomy between native theme state and CSS state and because frankly it happens to be simpler to implement given some other changes I'm making.  ;)
> 
> Should the spec describe behavior here?  Would Opera and Microsoft be willing to match WebKit and Gecko on this?

Here's the bug where the functionality was added to WebKit: <https://bugs.webkit.org/show_bug.cgi?id=3244>. Note that we similarly propagate :active from the label to the control. Apparently at the time we thought all this followed from HTML4 requirements for label.

Regards,
Maciej

Received on Tuesday, 10 May 2011 07:45:50 UTC