Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
6190fb8
new rule: Text spacing specified via CSS styles is below permissible …
jeeyyy Mar 30, 2020
bd71e34
Merge branch 'develop' into rule-b8bb68
jeeyyy Apr 6, 2020
5edc983
Apply suggestions from code review
jeeyyy Apr 6, 2020
3fc46cf
update rule
jeeyyy Apr 7, 2020
2d8679e
Merge branch 'develop' into rule-b8bb68
jeeyyy Apr 7, 2020
cf07cfb
update rule
jeeyyy Apr 7, 2020
901dec9
Merge branch 'rule-b8bb68' of github.com:act-rules/act-rules.github.i…
jeeyyy Apr 7, 2020
0704c62
Merge branch 'develop' into rule-b8bb68
jeeyyy Apr 15, 2020
44bd73f
update to pass tests
jeeyyy Apr 15, 2020
12180a0
merge from develop
jeeyyy Apr 15, 2020
382301e
update spelling
jeeyyy Apr 15, 2020
5340de2
merge from develop
jeeyyy Apr 28, 2020
7469b82
revert changes to another rule, that will be a diff pr
jeeyyy Apr 28, 2020
ee1968c
revert 36b590
jeeyyy Apr 28, 2020
be29569
revert 36b590
jeeyyy Apr 28, 2020
6684b94
merge from develop
jeeyyy Apr 28, 2020
676a16e
updates
jeeyyy Apr 28, 2020
f395c78
update
jeeyyy Apr 28, 2020
8117664
update
jeeyyy May 1, 2020
fe744aa
Merge branch 'develop' into rule-b8bb68
jeeyyy May 1, 2020
e27e131
updates
jeeyyy May 4, 2020
8c0e3d8
update examples
jeeyyy May 4, 2020
5dc3d83
Merge branch 'develop' into rule-b8bb68
jeeyyy May 4, 2020
cdd6b7c
update
jeeyyy May 4, 2020
f6d7749
Merge branch 'rule-b8bb68' of github.com:act-rules/act-rules.github.i…
jeeyyy May 4, 2020
30496a9
update
jeeyyy May 5, 2020
cf8fe25
Merge branch 'develop' into rule-b8bb68
jeeyyy May 7, 2020
7a38ad3
Merge branch 'develop' into rule-b8bb68
jeeyyy May 28, 2020
59bba19
Merge branch 'develop' into rule-b8bb68
jeeyyy Jun 8, 2020
b835247
update example descriptions
jeeyyy Jun 8, 2020
b5345ee
update expectations and example desc
jeeyyy Jun 8, 2020
87742fe
Apply suggestions from code review
jeeyyy Jun 11, 2020
63ee8c4
Merge branch 'develop' into rule-b8bb68
jeeyyy Jun 17, 2020
96e3677
Merge branch 'develop' into rule-b8bb68
jeeyyy Jun 22, 2020
45db2ea
update
jeeyyy Jun 23, 2020
49e754f
Merge branch 'develop' into rule-b8bb68
jeeyyy Jun 23, 2020
cf3dc6b
updat expectations
jeeyyy Jun 23, 2020
ecdc20a
Merge branch 'rule-b8bb68' of github.com:act-rules/act-rules.github.i…
jeeyyy Jun 23, 2020
45680ed
update
jeeyyy Jun 23, 2020
ca72bd9
Apply suggestions from code review
jeeyyy Jun 24, 2020
ea6f90e
Merge branch 'develop' into rule-b8bb68
jeeyyy Jun 24, 2020
5c137c1
Merge branch 'develop' into rule-b8bb68
jeeyyy Jun 29, 2020
348498a
Apply suggestions from code review
jeeyyy Jun 29, 2020
33351bb
Merge branch 'develop' into rule-b8bb68
jeeyyy Jul 5, 2020
249f80e
update rule
jeeyyy Jul 6, 2020
93923d1
Merge branch 'rule-b8bb68' of github.com:act-rules/act-rules.github.i…
jeeyyy Jul 6, 2020
e074909
fix tests
jeeyyy Jul 6, 2020
1e8af6a
Apply suggestions from code review
jeeyyy Jul 6, 2020
a6ea590
update rule
jeeyyy Jul 6, 2020
4c8c9cb
update rule
jeeyyy Jul 6, 2020
d1d7d33
Merge branch 'develop' into rule-b8bb68
jeeyyy Jul 7, 2020
7e5bab3
Apply suggestions from code review
jeeyyy Jul 7, 2020
effd3a9
Merge branch 'develop' into rule-b8bb68
jeeyyy Jul 7, 2020
78c727a
Merge branch 'develop' into rule-b8bb68
jeeyyy Jul 7, 2020
a0fedfa
fix: expectation
jeeyyy Jul 9, 2020
7677c90
Apply suggestions from code review
jeeyyy Jul 9, 2020
8cfe4c5
update rule
jeeyyy Jul 9, 2020
6619e81
Merge branch 'develop' into rule-b8bb68
jeeyyy Jul 10, 2020
27ad835
editorial changes
jeeyyy Jul 13, 2020
6c27d1d
Merge branch 'develop' into rule-b8bb68
jeeyyy Jul 13, 2020
5f5dbbe
update rule
jeeyyy Jul 21, 2020
4336e63
merge from develop
jeeyyy Jul 21, 2020
c29bfb0
Merge branch 'develop' into rule-b8bb68
jeeyyy Jul 23, 2020
9920fe7
Merge branch 'develop' into rule-b8bb68
jeeyyy Aug 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions __tests__/spelling-ignore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,26 @@
- labelable
- merchantability
- de-hello
- 14pt
- 18pt
- Helvetica
- stylesheet
- DeviceOrientation
- fieldsets
- ascii # lowercase needed in reference list
- CMS
- dropdown

- 14pt
- 18pt
- 32px
- 2em
- 10px
- 24px
- 8px

# spell checker checks against strict casing & hence some repeated words here
- Autocomplete
- Focusable

# Parts of url
- http
- https
Expand Down Expand Up @@ -206,3 +217,6 @@
- cantTell
- TestSubject
- earl:cantTell

# fns
- getComputedPriority
2 changes: 1 addition & 1 deletion _rules/invalid-form-field-value-36b590.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,4 @@ There are no elements with any of the required [semantic roles][semantic role].
[required context]: https://www.w3.org/TR/wai-aria/#scope
[semantic role]: #semantic-role 'Definition of semantic role'
[text]: https://www.w3.org/TR/WCAG21/#dfn-text
[visible]: #visible 'Definition of visible'
[visible]: #visible 'Definition of visible'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't change. We don't want this commit message to end in the history of the form-field-value rule.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix this.

263 changes: 263 additions & 0 deletions _rules/text-spacing-not-important-b8bb68.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
---
id: b8bb68
name: Text spacing in `style` attributes is not `!important`
rule_type: atomic
description: |
This rule checks that the text spacing styles can be adjusted by user, i.e. that `!important` is not applied to the style, unless the style has already exceeded the specified metric for retaining content visibility and functionality.
accessibility_requirements:
wcag21:1.4.12: # Text Spacing (AA)
forConformance: true
failed: not satisfied
passed: further testing needed
inapplicable: further testing needed
input_aspects:
- DOM Tree
- CSS Styling
acknowledgments:
authors:
- Jey Nandakumar
---

## Applicability

This rule applies to any HTML element that is [visible][], for which one of the following is true:

- the `style` attribute [declares][declared][][word-spacing][] CSS property; or
- the `style` attribute [declares][declared][][letter-spacing][] CSS property; or
- the `style` attribute [declares][declared][][line-height][] CSS property.
Comment on lines +23 to +27
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we concluded to split this rule, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that is right & here is the secondary PR, where there are 3 atomic rules addressing test spacing.


## Expectation 1

For the test target's [word-spacing][] property, one of the following is true:

- has no [declared][] value; or
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kinda makes me think there should be three separate rules here. We're using conditional logic in the expectations to get around the issue that the applicability is too broad. What would others think about breaking this into 3 rules?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WilcoFiers we discussed the possibility to split this rule into 3 in this conversation.

@Jym77 and @EmmaJP lets discuss this again.

Personally I am open to it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also open to it.
From the logical point of view, I agree that using expectations for a "or" case analysis is odd and splitting the rule would be more streamlined.
From a complexity point of view, it would be 3 super simple rules that are a bit "lost" if we look at them individually and keeping them together gives more punch to the result.


🤔 with the conditional list in expectations, and the weird case in each "the property has no declared value", I say I'm slightly in favour of splitting.

- the [declared][] value specified via the `style` attribute does not have the [important flag][]; or
- the [computed][] value is at least `0.16` times its [computed][] [font-size][].

## Expectation 2

For the test target's [letter-spacing][] property, one of the following is true:

- has no [declared][] value; or
- the [declared][] value specified via the `style` attribute does not have the [important flag][]; or
- the [computed][] value is at least `0.12` times its [computed][] [font-size][].

## Expectation 3

For the test target's [line-height][] property, one of the following is true:

- no [declared][] value; or
- the [declared][] value specified via the `style` attribute does not have the [important flag][]; or
- the [computed][] value is at least `1.5` times its [computed][] [font-size][].

## Assumptions

If there is a mechanism available on the page by which text spacing can be adjusted, failing this rule might not mean [success criterion 1.4.12 Text spacing](https://www.w3.org/TR/WCAG21/#text-spacing) is not satisfied.

## Accessibility Support

While some assistive technologies are able to set [user origin][] styles, others, such as browser extensions, are only able to set style with the [author origin][]. Such assistive technologies can not create styles with a high enough [priority][] to override a `style` attribute with the [important flag][]. If accessibility support does not include assistive technologies that override text spacing through [author origin][], this rule should not be used.

## Background

- [Understanding Success Criterion 1.4.12: Text Spacing](https://www.w3.org/WAI/WCAG21/Understanding/text-spacing.html)
- [CSS Text Module Level 3 - Spacing](https://www.w3.org/TR/css-text-3/#spacing)
- [CSS Visual formatting model details](https://drafts.csswg.org/css2/visudet.html)

## Test Cases

### Passed

#### Passed Example 1

This `p` element has a `line-height` of `32px` (equals `2em` ) which is above the recommended metric, given the specified font size is 16 pixels.

```html
<html>
<style>
body {
font-size: 16px;
}
</style>

<body>
<p style="line-height: 32px; !important">
The toy brought back fond memories of being lost in the rain forest.
</p>
</body>
</html>
```

#### Passed Example 2

This `div` element has a `letter-spacing` of `0.12em` which is equal to the recommended minimum, given the specified font size is 16 pixels.

```html
<html>
<style>
body {
font-size: 16px;
}
</style>

<body>
<div style="letter-spacing: 0.12em; !important">
The toy brought back fond memories of being lost in the rain forest.
</div>
</body>
</html>
```

#### Passed Example 3

This `strong` element has a `word-spacing` of `1.92pt !important` (equals `0.12em`) which is equal to the recommended minimum, given the specified font size is 16 pixels.

```html
<html>
<style>
body {
font-size: 16px;
}
</style>

<body>
<strong style="word-spacing: 1.92pt !important;">
The toy brought back fond memories of being lost in the rain forest.
</strong>
</body>
</html>
```

### Failed

#### Failed Example 1

This `p` element has a `line-height` of `10px !important` (equals `0.625em` ) which is below the recommended minimum, given the specified font size of the body is 16 pixels.

```html
<html>
<style>
body {
font-size: 16px;
}
</style>

<body>
<p style="line-height: 30px !important">
The toy brought back fond memories of being lost in the rain forest.
</p>
</body>
</html>
```

#### Failed Example 2

This `div` element has a `letter-spacing` of `1.5px !important` (equals `0.09375em`) which is below to the recommended minimum, given the specified font size is 16 pixels.

```html
<html>
<style>
body {
font-size: 16px;
}
</style>

<body>
<div style="letter-spacing: 1.5px !important;">
The toy brought back fond memories of being lost in the rain forest.
</div>
</body>
</html>
```

#### Failed Example 3

This `strong` element has a `word-spacing` of `2.5px !important` (equals `0.15625em` ) which is below the recommended minimum, given the specified font size is 16 pixels.

```html
<html>
<style>
body {
font-size: 16px;
}
</style>

<body>
<strong style="word-spacing: 8px !important;">
The toy brought back fond memories of being lost in the rain forest.
</strong>
</body>
</html>
```

### Inapplicable

#### Inapplicable Example 1

This `p` element is not [visible][] because of `display: none`.

```html
<p style="display: none">
The toy brought back fond memories of being lost in the rain forest.
</p>
```

#### Inapplicable Example 2

This text is not [visible][] because it is positioned off screen.

```html
<p style="position: absolute; top: -999em">
The toy brought back fond memories of being lost in the rain forest.
</p>
```

#### Inapplicable Example 3

This `body` element does not have a `style` attribute specified.

```html
<html>
<style>
body {
line-height: 50px;
}
</style>

<body>
The toy brought back fond memories of being lost in the rain forest.
</body>
</html>
```

#### Inapplicable Example 4

This `p` element has a [line-height][] of `24px` specified via the style attribute, but does not have the [important flag][].

```html
<html>
<style>
body {
font-size: 16px;
}
</style>

<body>
<p style="line-height: 24px;">
The toy brought back fond memories of being lost in the rain forest.
</p>
</body>
</html>
```

[visible]: #visible 'Definition of visible'
[word-spacing]: https://www.w3.org/TR/css-text-3/#word-spacing-property 'CSS Text Module Level 3 - Word Spacing: the word-spacing property'
[letter-spacing]: https://www.w3.org/TR/css-text-3/#propdef-letter-spacing 'CSS Text Module Level 3 - Tracking: the letter-spacing property'
[line-height]: https://drafts.csswg.org/css2/visudet.html#propdef-line-height 'CSS Visual formatting model details - line-height property'
[priority]: https://www.w3.org/TR/cssom/#dom-cssstyledeclaration-getpropertypriority 'CSS Object Model (CSSOM) - Definition getComputedPriority'
[computed]: https://www.w3.org/TR/css-cascade-3/#computed-value 'CSS Cascading and Inheritance Level 3 - Computed Values'
[author origin]: https://drafts.csswg.org/css-cascade-4/#cascade-origin-author 'CSS Cascading and Inheritance Level 4 - Cascading Origins - Author Origin'
[user origin]: https://drafts.csswg.org/css-cascade-4/#cascade-origin-user 'CSS Cascading and Inheritance Level 4 - Cascading Origins - User Origin'
[font-size]: https://www.w3.org/TR/css-fonts-3/#propdef-font-size 'CSS Fonts Module Level 3- Font size: the font-size property'
[important flag]: https://www.w3.org/TR/cssom/#css-declaration-important-flag 'CSS Object Model (CSSOM) - important flag'
[declared]: https://www.w3.org/TR/css-cascade-3/#declared 'CSS Cascading and Inheritance Level 3 - Declared Values'