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

[css-selectors] :focus and :checked

From: Brian Kardell <bkardell@gmail.com>
Date: Tue, 2 Aug 2016 15:31:23 -0400
Message-ID: <CADC=+jc1Jxg4Lcxt9fX55LBkaY4=7PYgb81riB58XB8Fd49s_g@mail.gmail.com>
To: "www-style@w3.org" <www-style@w3.org>
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

   <label for="x">Blah</label>
<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?

Brian Kardell :: @briankardell
Received on Tuesday, 2 August 2016 19:38:03 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:04 UTC