W3C home > Mailing lists > Public > www-style@w3.org > August 2016

Re: [css-selectors] :focus and :checked

From: Florian Rivoal <florian@rivoal.net>
Date: Fri, 5 Aug 2016 18:15:24 +0900
Cc: "www-style@w3.org" <www-style@w3.org>
Message-Id: <3A9AA770-3838-48C7-BF40-C1F31CCFC6F2@rivoal.net>
To: Brian Kardell <bkardell@gmail.com>

> On Aug 3, 2016, at 04:31, Brian Kardell <bkardell@gmail.com> wrote:
> 
> People can do a lot with the 'checkbox hack' and I see designers all the time bend over backwards trying to manage this so that labels are in sibling relationships, but this is occasionally impractical or even impossible.  In other words, given
> 
> 
> <div>
>    <label for="x">Blah</label>
> </div>
> <input type="checkbox" id="x">
> 
> You're screwed. Labels proxy their clicks to set focus on their input or check a checkbox or select a radio button, but there's no bi-directional relationship. I know that this has come up in the past, but in the past it looks like there were mostly concerns about things like :hover[1] because of perf, or ideas that other things like subjects/reference combinators would solve the problem another way.  The latter doesn't seem like it is gonna happen soon and the former is only part of the problem - maybe the least useful one.
> 
> :focus and :checked are certainly more 'rare' events and it feels like at least maybe those we could afford to support-bidirectionally.  If developers were able to style a label when the input were :checked or :focused that seems like it would be a small, but powerful win that would open lots of new possible doors.
> 
> Can we do this?

We've actually already resoled on this for :hover and :active (and transitively for :focus as well, since in the same session we resolved on having the same transitivity rules that apply to :active also apply to :focus).


https://lists.w3.org/Archives/Public/www-style/2014Nov/0553.html

But the definition of this is in HTML, not CSS, and IIRC I failed to convince the whatwg.

https://lists.w3.org/Archives/Public/public-whatwg-archive/2014Nov/0147.html (I think there were more mails, but I cannot find them right now).

Theoretically, there's still an action on me to convince them, but I am happy to get your help on that. If revisiting the discussion in the CSSWG to get a fresh resolution would provide a better basis for arguing the case, I'm fine with doing that too.

> [1] https://lists.w3.org/Archives/Public/public-whatwg-archive/2014Nov/0076.html <https://lists.w3.org/Archives/Public/public-whatwg-archive/2014Nov/0076.html>

 - Florian
Received on Friday, 5 August 2016 09:18:04 UTC

This archive was generated by hypermail 2.3.1 : Friday, 5 August 2016 09:18:04 UTC