-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Something like the hidden attribute but still mapped to the accessibility API #4623
Comments
This sounds like a good place to use |
I've been trying to track all the threads for adding similar to CSS recently. As far as I can tell, the most recent discussion, with links to some previous discussions, is w3c/css-a11y#13 Whatever the solution, something like this is certainly something missing from the platform. |
This does seem like a semantic of sorts that's best conveyed in markup. cc @whatwg/a11y |
in essence, something like the opposite of (with some context that this goes around the lengthy to-ing and fro-ing we had on twitter yesterday https://twitter.com/jon_neal/status/1128260090019106820) |
I have a few disconnected thoughts:
|
I'm not convinced by the use cases (so far). The need to provide information only for screen reader users is much less common than people think. The information is almost always useful to more people than is first thought. That aside, the first use case could be met like this:
The skip link use case seems to be a visual use case, not an accessibility API use case? Whether it is visible or not is irrelevant to most screen reader users, and whether it's exposed to the acc API is irrelevant to its visual state, so I'm not sure what this use case is trying for. |
discussing this a bit more with @IanPouncey he made an excellent point that the "this element should be visually hidden, but remain accessible" aspect is probably more a presentational, rather than purely semantic, issue - so perhaps something more suited to a very declarative CSS way of saying it. the problem, as i see it, with the various of course, getting a nice clean CSS way to say "this should be visually hidden, not affect layout (so not |
Agree with many of the points above. Especially Alice's mention of:
There are already many ways to visually hide content with CSS, whether that be However, depending on the type of content that needs to be hidden, and how accessible it should remain to different input types, should dictate to an author the method they employ to visually hide said content. I worry that a proposal to make an element accessible but not contribute to the document's layout would just perpetuate usability issues with current visually hidden techniques. For instance, the mentioned This ruleset works well in the context of a device with a keyboard and standard focus and blur events, but can pose problematic on devices where one may not be able to "focus" (e.g. VoiceOver's focus indicator does not initially fire a focus event, so content remains visually hidden). Additionally, attempting to find such content (being a 1px invisible square n' all) can also pose problems if someone is exploring by touch on their device, rather than sequentially swiping through content with the aid of a screen reader. Issues like this are prevalent when people attempt to visually hide a form control, and replace it with a faux control. Low vision users who may be using a screen reader for assistance may attempt to touch or drag their finger to find the element that is visually represented, but encounter difficulty because the true control is only discoverable if they swipe through the interface. The alternative to all of this is a solution where an element (and any children) are visually hidden but are not removed from contributing to the document's layout... but then we're just talking about I have many more thoughts on this topic, but I think it's important to note @LJWatson's response as well as @alice's quoting of the WebAIM article. Visually hidden content is more often a solution for developers to solve a design or UX issue, than it is an actual benefit to end users. Comparing this ask to the |
I understand that it would be better never to hide content visually, but it's just not the reality. Even you wrote an article for the accessibility blog on gov.uk, where the class Also gov.uk itself, a site with probably high a11y ambitions, uses a similar class a lot (with all its associated code smell and risk of future breakage): Thanks for the tip about Could all these use cases e.g. on gov.uk really be solved without some kind of Thanks. |
and as @herrernst posted those screenshots without appropriate alternative text (which did make me chuckle in this discussion...) first one is a the second one is an |
@patrickhlauke Sorry, I noticed my mistake and wanted to correct it, thank you for doing it 😅 |
fwiw, as i had forgotten about this discussion for a while...i think i still have the same view here as back last year #4623 (comment) |
I think perhaps you misread my comment. I said the "need is much less common than people think", not that it's never warranted. The quote from WebAIM in the comment from @sundress is a good description of the situation:
But note that it says "most cases" not "all cases.
I'm not sure how this is relevant. I write a lot of things in places where accessibility is either out of my control, could be done differently, or both - including this issue we're commenting on.
I don't know because I haven't looked at all of them, but arguably many of the uses on that blog post are unnecessary. I don't think that phrases like "Posted by" and "Posted on" need to be explicitly indicated. The pattern of identifying the author and date of a post based on the proximity of that information to the heading and/or article tagline is well enough understood to make it unnecessary. See the Guardian and Wired for a couple of examples. If there is a need to indicate that information then doing it in ways that make it part of the design is entirely possible. See the New York Times for an example. The "Sharing and comments" heading could be replaced by Including words like "Comment" and "Replies" just add verbal noise to the page. The fact they're comments is clear from the context provided by the preceding heading, and the relationship between comments and replies is provided through the nested lists. To flip your question around, what are the cases on Gov.UK or elsewhere you think can't be solved through other means? |
Dear @LJWatson, thanks for your explanation, and sorry if I have sounded rude. Labeling sections (when necessary) makes sense.
Is there any alternative except a kind of visually-hidden class? Thanks for your patience. |
I want to semantically express when an element is not yet, or is no longer, directly relevant to the page’s visual presentation or layout. This means that, although the element has no perceivable visual impact on the page, its implicit native role semantics are still mapped to the accessibility API.
I see no way to currently express this with pure web standards, and I think all developers would benefit from such a feature.
A situations where an author would reach for a way to “visually hide” a thing is when visual information and visual cues need to be conveyed to non-visual users:
Another situation would be to visually obscure “Skip to content” links until they receive focus.
There is a
[hidden]
attribute to indicate when an element “is not yet, or is no longer, directly relevant to the page's current state, or that it is being used to declare content to be reused by other parts of the page as opposed to being directly accessed by the user.” However, this attribute is insufficient because it unmaps native role semantics from the accessibility API.Presently, the most common strategy used by authors to obscure elements from appearing or contributing to layout involves class names mapped to CSS declarations that accomplish the presentational effect without unmapping the element from the accessibility API.
I’m not sure if what I’m asking for is best solved by an HTML spec, an ARIA spec, or a CSS spec. However, what I’m asking for seems most similar to
[hidden]
, and so I am starting here.The text was updated successfully, but these errors were encountered: