Skip to content
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

Failure technique F87 contradicts the Accessible name and desc algorithm #433

Closed
Wildebrew opened this issue Jul 16, 2018 · 36 comments
Closed

Comments

@Wildebrew
Copy link

The Accessible name and description algorithm (v1.1) describes how content included using the CSS :before and :after pseudo classes should be included in the accessible name calculation for an element.
This actually works with most browser and screen reader combinations, see my CSS pseudo classes for screen readers Code Pen example.
But WCAG 2.0 Failure technique 87 forbids use of CSS content to communicate information.

Since CSS content is now a part of an element's accessible name, the WCAG spec can no longer outlaw its use, in my opinion.

I believe F87 pre dates the ANDC algorithm by a few years and the web techniques landscape has changed. In light of that I recommend updating this technique to say somethihg like "whereas CSS content can be used to communicate helpful information about an element it should not be used for essential information" altogether.
or to drop it.

@awkawk
Copy link
Member

awkawk commented Jul 28, 2018

Thanks @Wildebrew

Arguments to keep it:

  1. The test procedure requires that one checks whether the information is read by AT so if the content is read then the failure won't apply.

Arguments to remove it:

  1. AT support is much better now than when this technique was authored.
  2. The technique ignores that CSS is a technology that can be relied on, so it isn't appropriate to require that the information is available when CSS is off.

@mraccess77
Copy link

Personal thoughts - I belove it is not supported by screen readers in IE. Seems like pseudo elwmrns also complicates the situation for low vision users who use custom css fonts/color.

@Wildebrew
Copy link
Author

Wildebrew commented Jul 29, 2018 via email

@lauracarlson
Copy link
Contributor

Hello everyone,

@mraccess77 wrote:

Seems like pseudo elements also complicates the situation for low vision users who use custom css fonts/color.

@Wildebrew wrote:

The low vision/custom CSS stylesheet argument I can definitely see the point, but then the wording of F87 should be changed to explain that the failure is primarily related to the problems of users relying on custom style sheets. I wonder if custom style sheets can be written that preserve the content of pseudo elements. My CSS background is admittedly not strong enough to provide the answer on that.

+1 to the adding wording to F87 to explain the failure for user style sheets. @mraccess77 , @WayneEDick, @alastc, @allanj-uaag do you have suggestions on how best to word it? Jim, maybe add it to a LVTF agenda?

Related: A draft "Providing a Semantically Identified Icon Font with role=img" technique is in the Wiki.

@awkawk
Copy link
Member

awkawk commented Jul 30, 2018

Do we want to fail any content based on what a user style sheet does? How easy is it for a user to inadvertently cause the pseudo content to not display?

@Wildebrew
Copy link
Author

Wildebrew commented Jul 30, 2018 via email

@alastc
Copy link
Contributor

alastc commented Jul 30, 2018

Since CSS content is now a part of an element's accessible name, the WCAG spec can no longer outlaw its use, in my opinion.

Except that the description does primarily aim it at people who override / don’t use CSS. The point about CSS being a tech that can be relied on is valid, but the fact the acc-name calc includes CSS content doesn’t help/affect those using customised visual access.

Having said that, there are a couple of levels to customisation: You can start with the authored styles and over-ride them (e.g. with stylus plugin), which wouldn’t remove the before/after content. The windows high-contast mode is at the upper end of that, it does/did remove background images. Or the next level is that you can wipe out the author styles and only apply your styles, which would remove the before/after content. (I think the ‘reader’ view in some browsers would do that.)

We could update the 3rd part of the procedure to remove assistive tech, but I’m not sure that’s needed depending on your accessibility support statement? (I.e. if you’re relying on modern user-agents then it will automatically pass.)

I agree this should also apply to icon fonts & CSS images, there is a technique drafted somewhere for that... @lauracarlson?

@lauracarlson
Copy link
Contributor

lauracarlson commented Jul 30, 2018

Hi @awkawk

Do we want to fail any content based on what a user style sheet does?

I don't think so. I was thinking that the failure would be on authors for not providing role=img so that the user style sheet can hook to that. Check the draft "Providing a Semantically Identified Icon Font with role=img" technique in the Wiki.

@lauracarlson
Copy link
Contributor

Hi @alastc

I agree this should also apply to icon fonts & CSS images, there is a technique drafted somewhere for that... @lauracarlson?

Yes. It is "Providing a Semantically Identified Icon Font with role=img" in the Wiki.

@lauracarlson
Copy link
Contributor

Hi @awkawk,

You wrote:

How easy is it for a user to inadvertently cause the pseudo content to not display?

Pretty easily. As Alex Walker explained in The Final Nail in the Icon Fonts Coffin?, when a when a user overrides fonts, "they replace the alphanumeric characters but there are no replacements for these custom icons. We get left with big, ugly, unhelpful empty boxes instead."

Seren Davies goes into more detail in her Death to icon fonts presentation (Video) and speaker deck.

As for frequency Tyler Sticka states, They Fail Poorly and Often.

@awkawk
Copy link
Member

awkawk commented Jul 30, 2018

Are we talking about icon fonts or :before content more broadly?

@lauracarlson
Copy link
Contributor

Hi awkawk,

Are we talking about icon fonts or :before content more broadly?

I am concerned about icon fonts added via generated content. The LVTF and/or COGA may have broader concerns.

@awkawk
Copy link
Member

awkawk commented Jul 30, 2018

I think that we should figure out the answer to the question about generated content in general first?

@lauracarlson
Copy link
Contributor

Hi @awkawk,

You wrote:

I think that we should figure out the answer to the question about generated content in general first?

Do mean as F87 states general generated content items, for

users who need to customize or turn off style information in order to view content according to their needs, assistive technologies may not be able to access the information that is inserted using CSS

Alastair listed some examples: overriding authored styles via stylus plugin, windows high-contrast, direct application of user styles). After those he listed icon fonts & CSS images.

As @alastc said, "the fact the acc-name calc includes CSS content doesn’t help/affect those using customised visual access."

@awkawk
Copy link
Member

awkawk commented Jul 30, 2018

@lauracarlson What I mean is that we need to answer the question "is all non-decorative content provided as generated content in CSS a failure of WCAG's 1.3.1 SC?"

It is possible that the broad answer is no, but that some specific cases are.

This failure was easier when it was made because we didn't need to understand all of the low-vision access questions since the screen readers didn't read the content. Now that most screen readers seem to read it, we need to determine if the low vision questions suggest that it should still be a failure.

@lauracarlson
Copy link
Contributor

@awkawk ,

Thank you.

@Wildebrew
Copy link
Author

Wildebrew commented Jul 30, 2018 via email

@mbgower
Copy link
Contributor

mbgower commented Jul 30, 2018

Adding my low-tech review, it looks like the :before :after pseudo elements come at the tail end (step 6 of 7) of a cumulative accessible name process, and their use is pretty contained:

Otherwise, if the current node's role allows name from content, or if the current node is referenced by aria-labelledby, aria-describedby, or is a native host language text alternative element (e.g. label in HTML), or is a descendant of a native host language text alternative element:

Given the points raised by @Wildebrew, I think adding some additional text/explanation to the Failure is pretty crucial -- as @awkawk says, the test procedure can be passed where it is implemented properly -- and I think the wording of the title needs to be qualified.

But I'm a bit leery of it being removed entirely. At a minimum there should some solid testing to confirm AT support and determine how frequently things can be screwed up through improper use the pseudo elements.

@mraccess77
Copy link

I don’t think you can provide role img for pseudo content only for the element as a whole.

@WayneEDick
Copy link
Contributor

I use pseudo elements in my style sheets to show heading level and identify links without underlined text.
h1:before{
content:'. ';
}
h2:before{
content:'.. ';
}
h3:before{
content:'... ';
}
h4:before{
content:'... . ';
}
h5:before{
content:'.... .. ';
}
h6:before{
content:'... ... ';
}
a[href]:before{
content:'[';
}
a[href]:after{
content:']';
}

Best Wayne

@awkawk
Copy link
Member

awkawk commented Aug 1, 2018

Wayne, here's a page with the examples in it - what happens with your stylesheet is added to the rendering? http://awkawk.github.io/f87.html

@WayneEDick
Copy link
Contributor

WayneEDick commented Aug 1, 2018 via email

@WayneEDick
Copy link
Contributor

I think we should remove the technique. There are problems, but most are solvable. The questions to ask are:
Drawbacks:
Are there any identified ambiguities: They would be programmatically non-deterministic constructs.
I am not sure how to insert an icon font into a pseudo element. Can someone give me an example. We cannot insert roles into inserted content. They are flat, so we cannot insert elements. This is a real problem. ARIA label and labelledby. So, I am not sure ambiguities exist or if they do, are they in conflict with WCAG 2.1.

Advantages: if we included generated content into the accessible domain, generated would have to obey all of WCAG 2.1. That would have many more advantages than drawbacks.

We are living in a world where, like it or not, CSS content is semantic content in web pages. Maybe it's time to figure how to include it. This is a good discussion

Best, Wayne

@WayneEDick
Copy link
Contributor

I found a pseudo element with an icon value in StackOverflow.
div:before {
content: attr(data-background-icon);
font-family: "FontAwesome";
}

The following code shows how role =='img' can be enforced.

<title>icon psudo with div</title> <style> div[role="img"]:before { content: attr(data-background-icon); font-family: "FontAwesome"; } </style>
div without role.
div with role='img'.

Run it and see. The trick is only show the pseudo if the author added role=img to the element.

Could our own attribute like data-pseudo-role. The key is it can be designated.
Best Wayne

@mraccess77
Copy link

Regarding role img -- What I'm trying to say is that you have to apply the role to the whole element. So if you had a link with text and pseudo before content with a font icon you would have to apply to role img to the whole link. In that case if your user style did not apply a custom font on role's with img then the custom font would not be applied to the link element text or it's pseudo element. While that might be good for the pseudo content to not lose it's font-family the link would not changed to my preferred font.

Regarding replacement of pseudo content in your link/heading example -- say I have a link with pseudo content with some icon to indicate a new window. In your @WayneEDick example of adding content via user style sheets with pseudo element -- any content you added to distinguish links without underline (brackets) would then wipe out the author supplied pseudo content for the link with the icon showing that it opened a new window. Then you would loose information that was available to other people.

For what it's worth I don't seem to be able to select the text of pseudo content with the mouse or caret browsing mode in Chrome or Firefox.

@awkawk
Copy link
Member

awkawk commented Aug 2, 2018

@WayneEDick Can you describe how the example page worked with your user styles?

@mraccess77
Copy link

Browser also don't include the text of pseudo elements in their find feature.

@Wildebrew
Copy link
Author

Wildebrew commented Aug 2, 2018 via email

@WayneEDick
Copy link
Contributor

Hi,
I've been looking at @Wildebrew comment. On icon links with visually hidden directions for non-visual users.

So I constructed the following:

14th Amendment, US Constitution

Wouldn't this achieve the same result?

Wayne

@WayneEDick
Copy link
Contributor

Oops, I forgot and used live code.

<a href="http://www.nosetothepage.org/508/14thAmmend.html" aria-label="go to 14th Amendment"><i class="fas fa-arrow-alt-circle-right"</i> 14th Amendment, US Constitution</a>

Did I get your case wrong. If I got wrong why is aria-label not OK.

Wayne

@WayneEDick
Copy link
Contributor

WayneEDick commented Aug 9, 2018

Hi All,
I've been working on this problem. As I mentioned earlier, I would like generated content to be accessible. Unfortunately it is not. There are two factors that really make it inaccessible:

  1. Generated content is completely flat, it has no semantic structure. A <div> has considerable structure by comparison: class, id, role are available etc.. Pseudo elements are truly void of semantics.
  2. Browsers cannot find content values for generated content. If it is anything but decorative, users will not be able to search for important information.

These two factors eliminate generated content from pseudo elements from accessibility. The Failure 87 should stand with updated documentation.

What can be done:
The ARIA group included the generated content in pseudo elements in accessible names before there was any semantic support for the content.

I think we could include content from pseudo elements if ARIA group defined some aria-pseudo parameters. It would be important for these to be accessible from CSS so that assistive stylesheets could use them. Also, we must contact browsers to learn what is needed so that find-algorithms can find pseudo element content.

@w3c w3c deleted a comment from WayneEDick Aug 14, 2018
@alastc
Copy link
Contributor

alastc commented Aug 14, 2018

I think the change we are coming to is simply updating the 3rd part of the procedure from:

  1. If the inserted content is not decorative, check that the information is provided to assistive technologies and is also available when CSS is turned off.

To:

  1. If the inserted content is not decorative check that the information is also available when CSS is turned off.

Where @Wildebrew said:

I see legitimate use cases and they are a part of the accessible name algorithm, which they shouldn't be if WCAG outright forbids their use.

That assumes that "AT" is things which use accessible name, which is not always the case. Here the AT could be (as outlined in the description) something which over-rides CSS.

Just because they aren't valid as the only way to convey information doesn't mean they should not convey information to people who can access that way.

@alastc
Copy link
Contributor

alastc commented Sep 11, 2018

I think the summary of current status is that:

  • Screenreaders have generally caught up and can deal with pseudo content.
  • It is still an issue for people who over-ride the styles, that content can disappear, and is not searchable with browsers.

To try and condense this to two options:

  1. We keep the failure, but remove the 'with assistive technologies' phrases.
  2. We remove the failure.

I've created a PR (#473) so you can see the change from option 1.

So, if people agree that this is still an issue, is that change sufficient?

@lauracarlson
Copy link
Contributor

lauracarlson commented Sep 25, 2018

Wayne's analysis

@awkawk
Copy link
Member

awkawk commented Oct 1, 2018

Addressed in Pull request #473 - closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants