W3C home > Mailing lists > Public > www-style@w3.org > March 2015

Re: 'all' and the system focus outline

From: Cameron McCormack <cam@mcc.id.au>
Date: Tue, 17 Mar 2015 16:06:23 +1100
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: www-style list <www-style@w3.org>, Alice Boxhall <aboxhall@google.com>
Message-ID: <20150317050623.GB27130@wok.mcc.id.au>
Tab Atkins Jr.:
> I don't know how to fix this. :/  We probably dont' want to exclude
> 'outline' from being reset by 'all'; unlike 'direction' and
> 'unicode-bidi', it's a valid property, and wanting to reset it when
> you're using it for something *other than* focus outlines is valid.

I think it’s just another example of ‘all: unset’ not really solving the
problem the author is most likely to have, which is vaguely “reset
certain properties to some known values while not touching other
properties I don’t really care about”.

Some reset style sheets reset certain properties to known zero-ish
values, while not touching other properties.  Some other reset style
sheets set margin/padding/etc. to known good values, overriding UA-
dependent values that come from the UA style sheet.  Oh and set
display:block on these bunch of elements because UA style sheets haven’t
caught up yet (though by now they probably have).

I’m not sure this is really a solution either, but here’s an idea:

What about a mechanism that allows resetting a property back to its
value as specified in the UA style sheet but only if

  (a) that rule is required by a UA style sheet in a spec, and
  (b) that specific value of the property is required by the spec.

If (a) is false, then the rule is skipped.

If (b) is false, then the rule isn’t skipped but sets a known, specific
value.  Perhaps ‘unset’, or maybe we make a judgement per property and
write down those defaults in a spec.

Let’s call this new value ‘per-spec’ for the sake of talking about it.

So, the HTML spec would require rules such as:

  :focus { outline: auto; }
  p { display: block; }

(These rules are in the HTML spec’s UA style sheet, but it’s not clear
to me how required this is, given the wording in there:

  The CSS rules given in these subsections are, except where otherwise
  specified, expected to be used as part of the user-agent level style
  sheet defaults for all documents that contain HTML elements.)

If you then used this in a document:

  * { all: per-spec; }

these two rules wouldn’t be overridden, so paragraphs would remain
blocks and focused elements would have their outline.

For rules in the spec that are suggestions or where the specific values
are UA dependent, such as this one:

  mark { background: yellow; color: black; }

then this would be overridden, either by known useful values (perhaps
yellow and black) or by ‘unset’, depending on what we think is more

For rule in the UA style sheet that aren’t added because of a spec
requirement, these would be skipped.

You could model this by having two levels of the cascade of UA style
sheets: the lower level one would include all of the spec-required
rules plus rules for the “known good” values for rule that have UA
specific values; and the higher level one would include rules with
those UA specific values plus all the other random rules that UAs
include but which are not required by a spec.

When doing the cascade, a ‘per-spec’ value would knock out any values
that come from the higher level UA style sheet or any other level higher
than that.  (Hand waving for !important properties here.)

Cameron McCormack ≝ http://mcc.id.au/
Received on Tuesday, 17 March 2015 05:06:51 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:52:05 UTC