Skip to content

Commit 7d09984

Browse files
Jym77carlosapaduartetbostic32
authored
"Zoomed text node is not clipped with CSS overflow" [59br37]: split horizontal and vertical checks (#1823)
* Split definition of clipped by overflow * Split horizontal and vertical clipping Co-authored-by: Carlos Duarte <carlosapaduarte@gmail.com> Co-authored-by: Trevor R. Bostic <32486143+tbostic32@users.noreply.github.com>
1 parent 0edc9d0 commit 7d09984

File tree

4 files changed

+104
-46
lines changed

4 files changed

+104
-46
lines changed

_rules/zoom-text-no-overflow-clipping-59br37.md

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@ This rule applies to any [text node][] for which all of the following is true wh
3333

3434
**Note**: A [viewport size][] of 640 by 512 is equivalent to a [viewport size][] of 1280 by 1024 zoomed 200%.
3535

36-
## Expectation
36+
## Expectation 1
3737

38-
Each test target is not [clipped by overflow][clipped] of an [ancestor][] in the [flat tree][] when in a [viewport size][] of 640 by 512, except if the [clipping][clipped] [ancestor][] has at least one of the following:
38+
Each test target is not [horizontally clipped by overflow][horizontally clipped] of an [ancestor][] in the [flat tree][] when in a [viewport size][] of 640 by 512, except if the [clipping][horizontally clipped] [ancestor][] has a [computed][] [white-space][] of `nowrap`, and a [computed][] [text-overflow][] that is not `clip`
3939

40-
- **text-overflow**: A [computed][] [white-space][] of `nowrap`, and a [computed][] [text-overflow][] that is not `clip`; or
40+
## Expectation 2
4141

42-
- **line wrapping**: A [used][] [line-height][] equal to or greater than the height of its [bounding box][], or in case of a [computed][] [overflow][] of `clip`, its [content box][].
42+
Each test target is not [vertically clipped by overflow][vertically clipped] of an [ancestor][] in the [flat tree][] when in a [viewport size][] of 640 by 512, except if the [clipping][vertically clipped] [ancestor][] has a [used][] [line-height][] equal to or greater than the height of its [bounding box][], or in case of a [computed][] [overflow-y][overflow] of `clip`, its [content box][].
4343

4444
## Assumptions
4545

4646
If any of the following assumptions is true, failing this rule may not result in a failure of [success criterion 1.4.4 Resize text](https://www.w3.org/TR/WCAG21/#resize-text):
4747

4848
- There is no other mechanism for resizing text available on the page, that can be used to resize text to 200% without loss of information or functionality. This includes font resizing in the browser, or a javascript mechanism of resizing in the page.
4949

50-
- [Text nodes][text node] can not be [clipped by overflow][clipped] without loss of information, except for [text nodes][text node] with an [ancestor][] with `aria-hidden` set to `true`, or when specific styles have been applied to ensure text is clipped cleanly (text-overflow, line wrapping or hidden text).
50+
- [Text nodes][text node] can not be [horizontally][horizontally clipped] or [vertically clipped by overflow][vertically clipped] without loss of information, except for [text nodes][text node] with an [ancestor][] with `aria-hidden` set to `true`, or when specific styles have been applied to ensure text is clipped cleanly (text-overflow, line wrapping or hidden text).
5151

5252
- While [success criterion 1.4.4 Resize text](https://www.w3.org/TR/WCAG21/#resize-text) does not explicitly mention which viewport size has to be resized up to 200%, it is assumed that a [viewport size][] of 1280 by 1024 is applicable. A 1280 by 1024 [viewport size][] is explicitly mentioned under [success criterion 1.4.10 Reflow](https://www.w3.org/TR/WCAG21/#reflow).
5353

@@ -85,7 +85,7 @@ This [text node][] is fully [visible][] at a [viewport size][] of 640 by 512.
8585

8686
#### Passed Example 2
8787

88-
This [text node][] is [clipped][] using `text-overflow: ellipsis` at a [viewport size][] of 640 by 512. A link to a full version of the poem is also provided.
88+
This [text node][] is [horizontally clipped][] using `text-overflow: ellipsis` at a [viewport size][] of 640 by 512. A link to a full version of the poem is also provided.
8989

9090
```html
9191
<div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16px;">
@@ -118,7 +118,7 @@ This [text node][] is restricted to a single line, by setting a `line-height` th
118118

119119
#### Passed Example 4
120120

121-
This [text node][] is not [clipped][] with `overflow: hidden` because it has a parent with `overflow: auto` at a [viewport size][] of 640 by 512.
121+
This [text node][] is not [vertically clipped][] with `overflow: hidden` because it has a parent with `overflow: auto` at a [viewport size][] of 640 by 512.
122122

123123
```html
124124
<div style="overflow: hidden; height: 2em; font-size: 16px;">
@@ -133,7 +133,7 @@ This [text node][] is not [clipped][] with `overflow: hidden` because it has a p
133133

134134
#### Failed Example 1
135135

136-
This [text node][] is [clipped][] because it has a fixed height that does not leave enough space for the content to wrap.
136+
This [text node][] is [vertically clipped][] because it has a fixed height that does not leave enough space for the content to wrap.
137137

138138
```html
139139
<div style="overflow: hidden; height: 1.5em; font-size: 16px;">
@@ -144,7 +144,7 @@ This [text node][] is [clipped][] because it has a fixed height that does not le
144144

145145
#### Failed Example 2
146146

147-
This [text node][] is [clipped][] because its height is relative to the viewport height, leaving insufficient space for the page to be zoomed to 200% at a [viewport size][] of 1280 by 1024.
147+
This [text node][] is [vertically clipped][] because its height is relative to the viewport height, leaving insufficient space for the page to be zoomed to 200% at a [viewport size][] of 1280 by 1024.
148148

149149
```html
150150
<div style="overflow: hidden; height: 16vh; font-size: 16px;">
@@ -159,7 +159,7 @@ This [text node][] is [clipped][] because its height is relative to the viewport
159159

160160
#### Failed Example 3
161161

162-
This [text node][] is [clipped][] by style that is applied at a [viewport size][] width of 640.
162+
This [text node][] is [vertically clipped][] by style that is applied at a [viewport size][] width of 640.
163163

164164
```html
165165
<style>
@@ -179,6 +179,39 @@ This [text node][] is [clipped][] by style that is applied at a [viewport size][
179179
</div>
180180
```
181181

182+
#### Failed Example 4
183+
184+
This [text node][] is [vertically clipped][] at a [viewport size][] of 640 by 512.
185+
186+
```html
187+
<div style="overflow-y: hidden; height: 10px; white-space: nowrap; text-overflow: ellipsis; font-size: 16px;">
188+
Once upon a midnight dreary, while I pondered, weak and weary, Over many a quaint and curious volume of forgotten
189+
lore. While I nodded, nearly napping, suddenly there came a tapping.
190+
</div>
191+
```
192+
193+
#### Failed Example 5
194+
195+
This [text node][] is [horizontally clipped][] at a [viewport size][] of 640 by 512.
196+
197+
```html
198+
<style>
199+
.wordClip {
200+
overflow-x: hidden;
201+
white-space: nowrap;
202+
text-overflow: clip;
203+
width: 50px;
204+
height: 16px;
205+
line-height: 16px;
206+
font-size: 16px;
207+
}
208+
</style>
209+
<div class="wordClip">
210+
Once upon a midnight dreary, while I pondered, weak and weary, Over many a quaint and curious volume of forgotten
211+
lore. While I nodded, nearly napping, suddenly there came a tapping.
212+
</div>
213+
```
214+
182215
### Inapplicable
183216

184217
#### Inapplicable Example 1
@@ -238,20 +271,21 @@ This [text node][] with the text "Web Content Accessibility Guidelines 2.1" is f
238271
```
239272

240273
[attribute value]: #attribute-value 'Definition of Attribute Value'
241-
[clipped]: #clipped-by-overflow
242-
[visible]: #visible
243-
[viewport size]: #viewport-size
244-
[parent]: https://dom.spec.whatwg.org/#concept-tree-parent 'DOM parent, as of 2020/02/14'
245274
[ancestor]: https://dom.spec.whatwg.org/#concept-tree-ancestor 'DOM ancestor, 2020/02/13'
246-
[text node]: https://dom.spec.whatwg.org/#text
275+
[bounding box]: https://www.w3.org/TR/css-ui-3/#valdef-box-sizing-border-box
247276
[computed]: https://www.w3.org/TR/css-cascade-3/#computed-value
277+
[content box]: https://www.w3.org/TR/css-ui-3/#valdef-box-sizing-content-box
248278
[flat tree]: https://drafts.csswg.org/css-scoping/#flat-tree 'CSS draft, flat tree, 2020/02/14'
249-
[overflow]: https://www.w3.org/TR/CSS22/visufx.html#overflow
279+
[html element]: #namespaced-element
280+
[horizontally clipped]: #horizontally-clipped-by-overflow
250281
[line-height]: https://www.w3.org/TR/CSS22/visudet.html#propdef-line-height
251282
[line-height normal]: https://drafts.csswg.org/css2/#valdef-line-height-normal "CSS 2.2 (Editor's draft) - normal line-height"
252-
[white-space]: https://www.w3.org/TR/CSS22/text.html#propdef-white-space
283+
[overflow]: https://drafts.csswg.org/css-overflow/#overflow-properties
284+
[parent]: https://dom.spec.whatwg.org/#concept-tree-parent 'DOM parent, as of 2020/02/14'
285+
[text node]: https://dom.spec.whatwg.org/#text
253286
[text-overflow]: https://www.w3.org/TR/css-ui-3/#text-overflow
254-
[bounding box]: https://www.w3.org/TR/css-ui-3/#valdef-box-sizing-border-box
255-
[content box]: https://www.w3.org/TR/css-ui-3/#valdef-box-sizing-content-box
256287
[used]: https://www.w3.org/TR/css-cascade-4/#used 'CSS Cascading and Inheritance Level 4 (Working draft) - Used Values'
257-
[html element]: #namespaced-element
288+
[vertically clipped]: #vertically-clipped-by-overflow
289+
[viewport size]: #viewport-size
290+
[visible]: #visible
291+
[white-space]: https://www.w3.org/TR/CSS22/text.html#propdef-white-space

pages/glossary/clipped-by-overflow.md

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Horizontally Clipped by Overflow
3+
key: horizontally-clipped-by-overflow
4+
unambiguous: true
5+
objective: true
6+
---
7+
8+
A [node][] is <dfn>Horizontally Clipped by Overflow</dfn> if it has an [ancestor][] in the [flat tree][] with a [computed][] [overflow-x][] of `hidden` or `clip`, where changing the [overflow-x][] of all such [ancestors][ancestor] to `visible` would cause more of the [node][] to become [visible][].
9+
10+
#### Example of Horizontally Clipped by Overflow
11+
12+
This `img` element has an [ancestor][] `div` element with an `overflow-x` of `hidden`. The width of the `img` is greater than that of the [ancestor][] `div`, and so is clipped by the `overflow-x` property of the `div`.
13+
14+
```html
15+
<div style="width: 100px; overflow-x: hidden;">
16+
<img src="/test-assets/shared/w3c-logo.png" width="150" alt="Partial W3C Logo" />
17+
</div>
18+
```
19+
20+
[visible]: #visible
21+
[node]: https://dom.spec.whatwg.org/#node 'DOM node, as of 2019/02/14'
22+
[ancestor]: https://dom.spec.whatwg.org/#concept-tree-ancestor 'DOM ancestor, as of 2019/02/14'
23+
[flat tree]: https://drafts.csswg.org/css-scoping/#flat-tree 'CSS draft, flat tree, 2020/02/14'
24+
[computed]: https://www.w3.org/TR/css-cascade-3/#computed-value
25+
[overflow-x]: https://drafts.csswg.org/css-overflow/#overflow-properties
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Vertically Clipped by Overflow
3+
key: vertically-clipped-by-overflow
4+
unambiguous: true
5+
objective: true
6+
---
7+
8+
A [node][] is <dfn>Vertically Clipped by Overflow</dfn> if it has an [ancestor][] in the [flat tree][] with a [computed][] [overflow-y][] of `hidden` or `clip`, where changing the [overflow-y][] of all such [ancestors][ancestor] to `visible` would cause more of the [node][] to become [visible][].
9+
10+
#### Example of Vertically Clipped by Overflow
11+
12+
This `img` element has an [ancestor][] `div` element with an `overflow-y` of `hidden`. The height of the `img` is greater than that of the [ancestor][] `div`, and so is clipped by the `overflow-y` property of the `div`.
13+
14+
```html
15+
<div style="height: 100px; overflow-y: hidden;">
16+
<img src="/test-assets/shared/w3c-logo.png" height="150" alt="Partial W3C Logo" />
17+
</div>
18+
```
19+
20+
[visible]: #visible
21+
[node]: https://dom.spec.whatwg.org/#node 'DOM node, as of 2019/02/14'
22+
[ancestor]: https://dom.spec.whatwg.org/#concept-tree-ancestor 'DOM ancestor, as of 2019/02/14'
23+
[flat tree]: https://drafts.csswg.org/css-scoping/#flat-tree 'CSS draft, flat tree, 2020/02/14'
24+
[computed]: https://www.w3.org/TR/css-cascade-3/#computed-value
25+
[overflow-y]: https://drafts.csswg.org/css-overflow/#overflow-properties

0 commit comments

Comments
 (0)