-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alternative take on hgroup #5002
Comments
How about giving up the idea that heading levels must be integers?
This could be extended, e. g.:
|
Reinventing how headings work from scratch is unfortunately even less likely to succeed. We need to interoperate with the existing accessibility and general infrastructure for this stuff. Also, we need this to be extremely simple and efficient. There's a reason the text in the current standard hasn't been adopted in the past fifteen years. |
Am I correct in seeing this as a way to mitigate against authors not respecting the content model for Heading level aside for a moment, would it then be correct of me to interpret that the following: <hgroup>
<h2>Primary text</h2>
<p>Published: mm/yyyy</p>
<h4>h4 because HTML for styling reasons!</h4>
</hgroup> would combine the two headings into a single heading level N? (based on how i understand this text and again I know the <hN>Primary text, h4 because....</hN>
<p>Published...</p> |
@scottaohara yeah, Steve's concern about existing content and Mike's concern about the existing standard encouraging usage of h2-h6 inside As for your example, per the algorithm in OP it would end up with two headings, "Primary text" (with level 2, assuming no ancestors) and "h4 because HTML for styling reasons!" (with level 4, same assumption). Per the algorithm in my PR it would indeed become a single heading "Primary text Published: mm/yyyy h4 because HTML for styling reasons!" (with level 1, same assumption), but this issue is specifically about changing the approach in that PR if we can find agreement that OP would be better. |
Well, you could probably express something equivalent without fractional levels by introducing global (= traditional) and local levels, both integers:
|
@Crissov How would that help? How could you expose the local level to a11y? |
I would not (within existing frameworks). I would expose all I believe this is unproblematic for the Avengers and Dr. Strangelove examples in the spec, but it might become a problem for others, e. g. for ledes and taglines – some authors may even put full abstracts into |
IME doing audits, those devs who use Anecdata aside, there are techniques to review sites, as WebAIM did with its review of the top million web pages (and discovered that in standard, boring, current headings today, 1 in 20 are wrong). Might be good to look at real-world @scottaohara's example above would result in a heading too wordy to be of much use to those who rely on them most. |
@annevk thank you for clarifying. I personally think a mix of the two ideas might work best. I agree with this idea in that Where I have concerns about this idea is that two (or more) exposed headings that introduce a single section of content are also problematic, as it makes navigating by headings to get to new sections of content less reliable. So per this idea for The issue with all of this though is handling author misuse of <p>
my text
<div>div text</div>
more text
</p> becomes: <p>my text </p>
<div>div text</div>
more text Might not invalid code like: <hgroup>
<h2>Primary text</h2>
<h3>a subheading</h3>
<p>I'm not supposed to be here</p>
<h3>Another section of content</h3>
<p>Clearly I don't validate my code</p>
</hgroup> become: <hgroup>
<h2>Primary text</h2>
<h3>a subheading</h3>
</hgroup>
<p>I'm not supposed to be here</p>
<h3>Another section of content</h3>
<p>Clearly I don't validate my code</p> Or if that's out of the question, could invalid children within the I realize this was a bit long and deviates into more things to consider, so i appreciate your time in giving it thought. Thanks. |
I think we could probably do something differently with subsequent headings inside Changing the tree structure of |
Correct, the concept of a subheading would need to be created. Your response about handling authoring errors is unfortunate, but not unexpected. Thank you for clarifying that as well. |
Alternative proposal:
Then Given use of If the effort here is to justify This has the advantage of keeping existing heading parsing logic in place and compartmentalizing the logic of this new effort at a Document Outline Algorithm without blowing up 30 years of existing content and rules. It may also make uptake in user agents a bit easier to swallow. We can lean on a previous effort to mint For the sub-heading concept, we can argue that any non- |
Adding a new element for this is too costly in my opinion. It wouldn't have the correct styling, it wouldn't have the correct parsing, it wouldn't map at all to assistive technology in any existing user agent, and it doesn't have any mindshare. If we end up there I rather admit defeat and leave it to custom elements… |
That can be added as part of this overall process. I suggest bold by default.
As far as I know,
That is part of this process (exposing it to accessibility APIs, not mapping to AT). If UAs are going to already open up the guts to implement
With who? The
If we leave it to custom elements, then we have a fragmented approach for as many custom elements as developers decide to make. I feel that is the wrong approach. |
a suggestion:
|
@stevefaulkner interesting. What if we only made that work if the first element child is h1 and ignore the hgroup otherwise? Allowing an arbitrary child of the hgroup element to be the highest would not be ideal and perhaps it's safer to ignore |
@annevk I think requiring If the constraint is "don't change accessibility tree of earlier nodes based on later nodes", I think this could work:
A document conformance requirement could be that the first |
The idea behind requiring |
Sounds good to me! |
@annevk Is it possible to see some example code illustrating effect/requirements for the latest idea? since my aged head is having difficulties understanding. |
My understanding in examples: Scott's example above<hgroup>
<h2>Primary text</h2>
<h3>a subheading</h3>
<p>I'm not supposed to be here</p>
<h3>Another section of content</h3>
<p>Clearly I don't validate my code</p>
</hgroup> -> <hgroup>
<h2 role=heading aria-level=2>Primary text</h2>
<h3 role=generic>a subheading</h3>
<p>I'm not supposed to be here</p>
<h3 role=generic>Another section of content</h3>
<p>Clearly I don't validate my code</p>
</hgroup> Automatic level for
|
@zcorpan thanks that helps a lot, LGTM |
If everything but the first heading element in It feels conceptually overcomplicated to allow only Of course a decision has to be made for these cases so that clients know how to interpret legacy content. But please do not force the people of the future to continue to use a syntax whose vocabulary contradicts its meaning (such as having to use |
@prlbr not everything, only h1-h6 elements (which are the only allowed elements). Changing them so subheadings are not represented as actual headings is the point. Only allowing one h1-h6 in hgroup and then other content would make hgroup itself useless. |
I think this issue can be closed now that |
#3499 got quite a few comments, mostly from @sideshowbarker (and at w3c/html-aam#123 from @stevefaulkner), about
hgroup
.I've been thinking about this slight change to compute headings and heading levels to address the concerns raised:
I think this would also be in line with the existing way these elements get rendered when used in combination and how hgroup is typically used.
cc @whatwg/a11y
The text was updated successfully, but these errors were encountered: