W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2010

[whatwg] :enabled and :disabled pseudo-classes should apply on fieldset elements

From: Jonas Sicking <jonas@sicking.cc>
Date: Tue, 7 Dec 2010 17:43:24 -0800
Message-ID: <AANLkTikh93G9gwK3UDnYf_P2VS_pQiqfiQ-CBfu8abn+@mail.gmail.com>
On Tue, Dec 7, 2010 at 5:08 PM, Ian Hickson <ian at hixie.ch> wrote:
> On Sun, 12 Sep 2010, Mounir Lamouri wrote:
>> The current state of the specifications do not mention fieldset elements
>> for the :enabled and :disabled pseudo-classes but fieldset can be
>> disabled so I guess it might be convenient to have these pseudo-classes
>> applied to them.
>> Opera applies :disabled and :enabled to fieldset elements and Mozilla
>> might do the same.
> It's not really the <fieldset> that is enabled/disabled, it's the
> controls within it. Put it this way: if we dropped support for disabled=""
> from the spec, I think one would still argue that <input> is :enabled

Really? Why then isn't a <div> ever :enabled?

:enabled IMHO only makes sense on elements which can be disabled,
which is why div:enabled never matches anything. So if we removed
disabled="" from <input> I don't think input:enabled would match

>, but
> I don't think one would argue that <fieldset> is :enabled. Case in point,
> nobody argued that <fieldset> should match :enabled before we added the
> disabled="" attribute to it.

IMHO because it couldn't be disabled before then. Another question is,
on what basis are you saying that just the controls inside the
fieldset are disabled, and not also the fieldset itself?

I think a more important question is if it would be useful to have
fieldset:disabled match. I.e. would anyone want to use that selector
in CSS or querySelector? I have many times seen user interfaces like:

[X] Some preference
   [  ] Sub-preference 1
   [  ] Sub-preference 2

Where the sub-preferences are grayed out if the top-level preference
is. And it's generally not just the sub-pref checkboxes that are
grayed out, but also the labels next to them. This could be
accomplished using a selector like:

fieldset:disabled .controlLabel {
  color: gray;

/ Jonas
Received on Tuesday, 7 December 2010 17:43:24 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:28 UTC