Skip to content

Commit 5366312

Browse files
committed
Bringing back the reading-order property
1 parent 7ffdc91 commit 5366312

File tree

1 file changed

+56
-4
lines changed

1 file changed

+56
-4
lines changed

css-display-4/Overview.bs

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,6 @@ The order is determined by the 'reading-flow' property.
11761176

11771177
ISSUE(9922): Should this property also apply to tables?
11781178

1179-
ISSUE(9230): Define how reading-flow interacts with focusable display: contents elements.
11801179

11811180
<pre class='propdef'>
11821181
Name: reading-flow
@@ -1319,9 +1318,61 @@ ISSUE(9230): Define how reading-flow interacts with focusable display: contents
13191318
</pre>
13201319
</div>
13211320

1321+
<h3 id='reading-order'>
1322+
Overriding Reading Flow: the 'reading-order' property</h3>
1323+
<pre class='propdef'>
1324+
Name: reading-order
1325+
Value: <<integer>>
1326+
Initial: 0
1327+
Applies to: Direct children of a reading flow container
1328+
Inherited: no
1329+
Computed value: specified integer
1330+
Animation type: by computed value type
1331+
</pre>
1332+
1333+
The 'reading-order' property lets the author change where in the reading flow an item is visited,
1334+
overriding the position set by the 'reading-flow' property on its parent.
1335+
It takes a single <dfn value for=reading-order><<integer>></dfn> value,
1336+
which specifies which ordinal group the item belongs to.
1337+
Sibling elements are ordered starting from the lowest numbered ordinal group and going up.
1338+
1339+
If the reading order of two items is equivalent, the 'reading-flow' property breaks the tie.
1340+
1341+
<div class='example'>
1342+
In this example there are six grid items,
1343+
the 'grid-auto-flow' property has a value of ''dense'',
1344+
therefore items may display out of source order.
1345+
The 'reading-order' property on the item with a class of 'top' is '-1'
1346+
Therefore Item 4 will be the first item in reading flow.
1347+
The remaining items will be visited in the order they display in rows,
1348+
as 'reading-flow' has a value of 'grid-rows'.
1349+
1350+
<pre class="lang-markup">
1351+
&lt;div class="wrapper"&gt;
1352+
&lt;a href="#"&gt;Item 1&lt;/a&gt;
1353+
&lt;a href="#"&gt;Item 2&lt;/a&gt;
1354+
&lt;a href="#"&gt;Item 3&lt;/a&gt;
1355+
&lt;a class="top" href="#"&gt;Item 4&lt;/a&gt;
1356+
&lt;a href="#"&gt;Item 5&lt;/a&gt;
1357+
&lt;a href="#"&gt;Item 6&lt;/a&gt;
1358+
&lt;/div&gt;
1359+
</pre>
1360+
1361+
<pre class="lang-css">
1362+
.wrapper {
1363+
display: grid;
1364+
grid-template-columns: repeat(3, 150px);
1365+
grid-auto-flow: dense;
1366+
reading-flow: grid-rows;
1367+
}
1368+
1369+
.top { reading-order: -1; }
1370+
</pre>
1371+
</div>
1372+
13221373
Advisement: The source document should express
13231374
the underlying logical order of elements.
1324-
The 'reading-flow' property exists for cases where a given document
1375+
The 'reading-flow' and 'reading-order' properties exist for cases where a given document
13251376
can have multiple reading orders depending on layout changes,
13261377
e.g. in response to [=media queries=].
13271378
In such cases, the most common or most fundamental reading order
@@ -2160,9 +2211,10 @@ Additions since Level 3</h3>
21602211

21612212
The following features were added since <a href="https://www.w3.org/TR/css-display-3/">CSS Display Module Level 3</a>:
21622213

2163-
* the 'reading-flow' property
2214+
* The 'reading-flow' property
21642215
(<a href="https://github.com/w3c/csswg-drafts/issues/8589#issuecomment-1721504153">Issue 8589</a>)
2165-
* the ability to animate 'display'
2216+
* The 'reading-order' property (<a href="https://github.com/w3c/csswg-drafts/issues/11208#issuecomment-2625850559">Issue </a>)
2217+
* The ability to animate 'display'
21662218

21672219
<h2 id="priv" class="no-num">
21682220
Privacy Considerations</h2>

0 commit comments

Comments
 (0)