SIA-R92!important word spacing in style attribute is wide enough
Accessibility requirements
This rule tests conformance of the following accessibility requirements:
Description
This rule checks that the style attribute is not used to prevent adjusting word-spacing by using !important, except if it's at least 0.16 times the font size.
Applicability
This rule applies to every element in the HTML namespace with a visible text node child, when all the following are true for the word-spacing property of the element:
The property can be declared on an ancestor of the test target.
Expectation
- The computed value of the
word-spacingproperty of the target element is at least 0.16 times the computed value of itsfont-sizeproperty.
Assumptions
This rule makes the following assumption:
-
There is no mechanism available on the page to adjust
word-spacing. -
The font size is constant for all text node children of the element. If
font-sizechanges (e.g., through use of the::first-linepseudo-element) then the required word spacing would also change throughout the element. -
WCAG's meaning for the "Word spacing style property" is the value of the CSS
word-spacingproperty rather than the actual space between words. The value of the CSS property is added to whichever spacing already exist (for example, due to the size of the space character, or to justification). Thus, the actual space between words can be larger than the value of theword-spacingproperty. -
The target text nodes children express something in a human language written in a script that that uses the
word-spacingproperty.
Accessibility support
While some assistive technologies are able to set user origin or user agent origin styles, others, such as browser extensions, are only able to set styles with the author origin. Such assistive technologies cannot create styles "winning" the cascade sort over a style attribute with an important declaration. If accessibility support does not include assistive technologies that override word-spacing through author origin, this rule should not be used.
Examples
Passed
This <p> element has a computed word-spacing of 0.2 times the font size.
<p style="word-spacing: 0.2em !important">
The quick brown fox jumps over the lazy dog.
</p>
The <div> element is inapplicable since it does not have any text node children. The <p> element has a computed word-spacing of 0.2 times its font-size.
<div style="word-spacing: 0.1em !important">
<p style="word-spacing: 0.2em !important;">
The quick brown fox jumps over the lazy dog.
</p>
</div>
Failed
This <p> element has a computed word-spacing of only 0.1 times the font size, which is below the required minimum.
<p style="letter-spacing: 0.1em !important">
The quick brown fox jumps over the lazy dog.
</p>
Inapplicable
The <div> element has no text node children.
<div style="letter-spacing: 0.1em !important;"></div>
This <p> element does not have an important computed word-spacing.
<p style="letter-spacing: 0.1em">
The quick brown fox jumps over the lazy dog.
</p>
Acknowledgments
This document includes material copied from or derived from https://www.w3.org/WAI/standards-guidelines/act/rules/9e45ec/. Copyright © 2024 W3C® (MIT, ERCIM, Keio, Beihang).