

Accessibility support for CSS generated content
source link: https://tink.uk/accessibility-support-for-css-generated-content/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Accessibility support for CSS generated content
Сообщение для российских читателей
The CSS before/after pseudo-selectors can be used to insert content into a page. In some situations this technique is a useful thing to do, but how do browsers and screen readers handle the generated content?
Quick recap: The before/after
selectors insert content either before or after an element’s existing content. For example the CSS shown below will insert "bar" immediately after the "Foo" that is already present in the HTML:
#a:after { content: 'bar'; }
<a href="/" id="a">Foo</a>
The result of which can be seen in this test case. For more information on using these selectors, read Chris Coyer’s introduction to after/before on CSS Tricks.
Accessibility mechanics
CSS generated content isn’t included in the DOM. Ordinarily browsers take information from the DOM to create the accessibility tree, but in this case the generated content is still factored into the accessible name computation for the element.
Accessibility results
Using the test case mentioned before indicates that generated content is accessibility supported in most browsers, and recognised by screen readers accordingly. Internet Explorer is the only browser regularly used with a screen reader that does not expose the generated content as the accessible name for the element. Screen readers depending on MSAA/UIAutomation in IE are therefore unaware of the generated content.
Browser and screen reader support for CSS generated content
Chrome 41 (Android)Chrome 41 (Windows)Firefox 36 (Windows)Internet Explorer 11 (Windows)Safari 8 (OSX)Safari 8.1 (iOS)Jaws 16N/AYesYesNoN/AN/ANVDA 2015.1N/AYesYesNoN/AN/ATalkBackYesN/AN/AN/AN/AN/AVoiceOverN/AN/AN/AN/AYesYesWith Internet Explorer accounting for about 15% of traffic (in March 2015), there is good reason to consider the viability of using CSS generated content.
There is another more important consideration however * the separation of content and structure from design. Introducing content through the design layer breaks the standards model, and so it should be done only when the generated content does not alter the meaning of the original content. In other words, use CSS generated content to change or supplement the design, but not to create or alter important content on the page.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK