-
Notifications
You must be signed in to change notification settings - Fork 50
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
<dl class="switch"> styling is not optimal for screen reader users #260
Comments
Are dt/dd announced in a way that might be sufficient if we consistently lead with "switching"? |
It probably depends on the screen reader, but I'm under the impression that they typically don't do much to indicate what is what in a |
If that's true we might have a bigger issue here. |
Recent testing by @gezlemon on description lists:
|
The main problem to solve here is that the I think Simon's idea of substituting the unicode char with the string "case: " for screen reader users would be a significant improvement. I hope we could just go forward with that as a first step. Beyond that, I don't think we should do anything to the |
It looks like this is exactly the case that https://drafts.csswg.org/css-content/#alt is meant to solve. Although browser support there is not great (upcoming Chrome, and a prefixed variant in Safari) it would be very easy to deploy, with just a one or two line change. We could do that ASAP and then work on a custom ligature font or similar afterward? |
I believe we should do that. Rationale: it’s objectively a less-ambiguous way to convey the information to everyone (not just screen-reader users) than the “↪" glyph is — and I think we should always place greater weight on any choice that avoids or reduces ambiguity.
Stepping back and thinking about it, Is there anyone who feels strongly the current visual rendering with the “↪" glyph is actually preferable? If so, it’d be useful to have them comment here to say why. Trying to consider it objectively now, I think the “↪" glyph presentation is just an idiosyncrasy — an unnecessary and unhelpful one. It has always been a quirky (mis)feature of the spec — it doesn’t align with how switch statements are presented in any other specs or documentation I can recall, at least. A few more commentsIt’s not clear to me at least why to begin with, the choice was made to use the “↪" glyph instead of just using as “Case:” prefix. It’s just, that’s the way it’s always been for a long time now. I don’t recall there ever having been a discussion about it originally, where any clear agreement emerged that it as clearly preferable for some reason. I think it’s worth noting that the places where these switch statements are used in the spec are almost always (or maybe even always, actually) in parts of the spec that are only for implementors — and the implementors understand what the “↪" glyph is meant to convey, including implementors who use screen readers. That is, those parts of the spec really aren’t intended for casual readers, so it could be argued that the ambiguity of what the “↪" glyph is meant to convey doesn’t cause that much confusion in practice. But even that said, even given the fact that implementors are the intended readers, I can’t say I know of any other place in any programming language or programming-language documentation where I have ever seen this “↪" glyph presentation used. But another point I want to add is that I have actually had occasion more than once to cite switch-statement parts of spec even to non-implementors. Specifically, there are times when I’ve come across questions posted to Stack Overflow, from developers who are confused about some browser behavior they’re running into, and wanting to know if it’s a browser bug or instead is actually behavior required by whatever relevant spec — and if so, what spec and what specific part of that spec. So in responding to those questions, I have sometimes (block)quoted parts of particular switch statements from specs. And there is at least once case I can remember when someone replied to ask what the “↪" glyph meant, and I needed to explain to them that the spec text I quoted was part of a switch statement. So to me that’s concrete evidence we’d be better off if we changed the presentation to make it more explicit and unambiguous that those spec parts are actually switch statements. |
The audience is very much software developers. It's not clear to me we need a glyph or "Case:" though. E.g., https://html.spec.whatwg.org/#update-the-session-history-with-the-new-page has neither at the moment and is also understandable. Even though we've had this styling and class for over a decade it seems fine to me to reconsider whether we need it at all. |
Good point. So, to look a concrete case: given https://dom.spec.whatwg.org/#dom-node-nodetype,
…what would you change there? A couple possibilities at the extremes:
#2 seems like the way to write is that’d be the most clear — but also obviously a lot more verbose, with a lot of redundant language. Kind similar to how, in a programming language, using an if-then-else statement that has lot of else conditions ends up being a lot more verbose than a switch statement. Given that, maybe a “Case:” prefix can have similar utility for reducing the possible verbosity while at the same time clearly conveying to readers — without readers needing to scroll back to the prefatory text at the top of list — that what they’re looking at is a series of (compactly-stated) conditions:
|
Thanks, I hope we can consider 2 a non-starter. (I'm not necessarily sure it's even more clear, as the verbosity makes it harder to scan.) I guess I'm okay with 3, if we don't have to add "Case:" manually all over as editors, but I personally prefer 1. |
As for the audience, this construct is used more widely than WHATWG specs. The case that @mcking65 found annoying to read with a screen reader was https://w3c.github.io/aria-practices/#name_calculation (which I wrote), which has web developers as target audience. I think omitting the symbol or "Case:" is likely clear enough in many cases, but when there are multiple So my preference is to change the styling to 3 (for all specs), and editors can decide to drop the |
Styling is ideally optional for understanding a spec; as far as I'm aware, the arrows were intended as a subtle visual hint, not as a replacement for prose that clearly conveys what's going on. If they are removed, the spec should still be understandable. I'd like to avoid spec authors depending on a particular styling and omitting information from the spec prose. (I'd also like to avoid invoking C++'s fall-through semantics.) So I'm not convinced that adding "Case:" in front here is super great. Wrt multiple DTs per DD, those semantics are defined clearly in the HTML spec, and they apply in many other places, not just switch statements. If someone has a problem understanding what that convention means, it's beyond the scope of how we style switch lists. If the arrows are objectionable generally, I lean towards either removing the markers entirely or replacing them with some other, less objectionable symbol. If it's just a question of providing a less obnoxious speech rendering, which I sympathize with since visually these markers are intended to be glossed over and reading out the Unicode name is definitely not that, then I'm happy to adjust the styling for speech. |
If they are basically eye candy, I can definitely say they are not ear candy. Obnoxious is a suitable adjective from my perspective. One thing that is sad about |
Except that "case" might make people think of switch constructs in certain languages as fantasai points out, which would be counter-productive. Maybe if |
https://github.com/whatwg/whatwg.org/blob/master/resources.whatwg.org/standard.css#L168
A
<dl class="switch">
in specs represents aswitch
statement in programming languages. For stylistic reasons we use an arrow character as generated content before eachdt
.Example: https://dom.spec.whatwg.org/#dom-node-nodetype
This renders as "rightwards arrow with hook" in screen readers, according to @mcking65, which is annoying and makes it hard to follow.
It would be better if it read as "Case:"
Maybe also the
<dl>
itself could be introduced with "Switch:" (possibly both visually and in screen readers).So I think there are a few options. Either we change the styling so that the text "Case:" is rendered for everyone. Or, if we don't want to change the visual rendering, we can use a custom font with a ligature that turns "Case:" into a “↪" glyph.
It would be nice to make this change for all specs that use this pattern (I'm aware of WHATWG specs and W3C specs), so they are consistent and accessible. cc @fantasai
The text was updated successfully, but these errors were encountered: