Add :heading and :heading() pseudo-classes#11413
Conversation
annevk
left a comment
There was a problem hiding this comment.
Thanks!
Should we revisit the UA style sheet at this point as well? Coupling them makes some sense to me.
|
I guess leaving out the change to the individual I'm double checking whether WebKit is interested, but I suspect so. |
| <code>h1</code>, <code>h2</code>, <code>h3</code>, <code>h4</code>, <code>h5</code>, and | ||
| <code>h6</code> elements.</p></dd> | ||
|
|
||
| <dt><dfn selector noexport data-x="selector-heading-functional">:heading(<var>An+B</var>#)</dfn></dt> |
There was a problem hiding this comment.
Consider linking these to https://www.w3.org/TR/css-syntax-3/#anb-microsyntax and maybe https://www.w3.org/TR/css-values-3/#mult-comma as these are both parts of CSS syntax that aren't otherwise mentioned in the HTML spec as far as I can tell.
There was a problem hiding this comment.
I've added references to these specs. Is that good enough?
There was a problem hiding this comment.
What I was thinking was the style the CSS specs use, where the parts of the syntax would be links to the spec section describing them. (Eg, the # would link to directly to the section saying what # does.)
But it looks like HTML doesn't link directly to CSS specs? If that's the case I think this should be fine, but I'm not an expert.
There was a problem hiding this comment.
That could be done, but not inside a dfn since they are interactive. The code is also turned into a link, so can't use links inside.
HTML doesn't define the syntax, that is defined in https://drafts.csswg.org/selectors-5/#headings so I think it's OK.
|
@fantasai pointed out to me that in w3c/csswg-drafts#10296 (comment) there was discussion about a different specificity for these pseudo-classes, but this does not appear to be reflected in the changes to the Selectors specification, despite claims back in April that it would be. Can someone clarify this for me? |
The spec states: https://drafts.csswg.org/selectors-5/#headings
This was updated in w3c/csswg-drafts#12404 which while not updated in April as claimed, was updated today! AIUI this is per the resolution in w3c/csswg-drafts#10296 (comment).
|
| <code>h5</code>, and <code>h6</code> elements that have a <span>heading level</span> among | ||
| <var>An+B</var>. <ref>CSSSYNTAX</ref> <ref>CSSVALUES</ref></p></dd> |
There was a problem hiding this comment.
This last part is quite vague, but I guess it's good enough?
There was a problem hiding this comment.
It's the same language as in https://drafts.csswg.org/selectors-5/#headings
I still don't have a strong opinion, I can see arguments for both class-level specificity and tag-level specificity. |
|
Aria would always supersede. Consequently
I wrote more about this over in w3c/csswg-drafts#12412 (comment) which hopefully details some of why it is untenable for |
|
Indeed, long ago we have settled on ARIA not influencing semantics. It's an expert tool that solely influences AT. (This does mean that |
Re:authoring error, I think there are valid use cases for overriding heading level via |
|
That's why I wrote highly indicative and not that it's set in stone. 😊 |
|
I think I'd prefer the polyfill use case to use attribute selectors for |
…, a=testonly Automatic update from web-platform-tests [selectors] Test :heading and :heading() See w3c/csswg-drafts#11836 and whatwg/html#11413 -- wpt-commits: 7ed8a2090bf6b7b601fd03aa29eb3100721df4fa wpt-pr: 53440
…, a=testonly Automatic update from web-platform-tests [selectors] Test :heading and :heading() See w3c/csswg-drafts#11836 and whatwg/html#11413 -- wpt-commits: 7ed8a2090bf6b7b601fd03aa29eb3100721df4fa wpt-pr: 53440
Fixes #11412.
(See WHATWG Working Mode: Changes for more details.)
/rendering.html ( diff )
/semantics-other.html ( diff )