Skip to content

Commit

Permalink
vertical / horizontal separation
Browse files Browse the repository at this point in the history
- vertical / horizontal text separated
- Link to CSS spec added
- Code example updated
- Test procedure vertical / horizontal text separated
  • Loading branch information
jake-abma authored Jul 20, 2018
1 parent 8d6ea9e commit 656b975
Showing 1 changed file with 71 additions and 53 deletions.
124 changes: 71 additions & 53 deletions techniques/css/flexbox-reflow.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ <h2>When to Use</h2>
</section>
<section id="description">
<h2>Description</h2>
<p>The objective of this technique is to be able to present content without introducing a horizontal scroll bar at a width equivalent to 320 CSS pixels and a vertical scroll bar at a height equivalent to 256 CSS pixels. This is done by using layout techniques that adapt to the available viewport space.</p>
<p>The objective of this technique is to be able to present content without introducing a horizontal scroll bar at a width equivalent to 320 CSS pixels, or a vertical scroll bar at a height equivalent to 256 CSS pixels for text intended to scroll horizontally. This is done by using layout techniques that adapt to the available viewport space.</p>
<p>Flexbox layouts define layout regions that reflow as needed to display the region on the screen. Although the exact layout therefore varies, the relationship of elements and the reading order remains the same when done right. This is an effective way to create designs that present well on different devices and for users with different zoom preferences.</p>
<p>The basic principles of flexbox layouts are to:</p>
<ol>
<li>Define the size of layout regions using flexbox properties and media queries for specific viewport sizes, so they enlarge, shrink or wrap in the available space and respond to zoom levels;</li>
<li>Position the layout regions in the flexbox container as a row of adjacent flexbox items, which may wrap to new rows as needed in much the same way as words in a paragraph wrap.</li>
</ol>
<p>Complex flexbox layouts may be achieved by nesting layout regions, thus creating localized flexbox layouts within a larger flexbox layout. Even simple flexbox layouts require design finesse to achieve good-looking results at a wide range of viewport sizes and zoom levels, but well-designed flexbox layouts can be the most effective page design.</p>
<p>NOTE: Flexbox has the possibility to cause a keyboard navigation disconnect by using the order and reverse properties. The CSS Flexible Box Layout module warns against resequencing content logic as they cause incorrect source ordering and are non-conforming.</p>
<p>NOTE: Flexbox has the possibility to cause a keyboard navigation disconnect by using the order and reverse properties. The <a href="https://www.w3.org/TR/css-flexbox-1/#order-accessibility">CSS Flexible Box Layout module warns</a> against resequencing content logic as they cause incorrect source ordering and are non-conforming.</p>
</section>
<section id="examples">
<h2>Examples</h2>
Expand All @@ -35,50 +35,51 @@ <h3>Example 1: Medium complex flexbox layout in HTML and CSS</h3>
<p>The following medium complex example uses HTML and CSS to create a flexbox layout. The layout regions adjust their size as the viewport is adjusted. When the total viewport width matches the width defined via media queries, columns wrap to be positioned below, rather than beside each other or vice versa.</p>
<p>The zoom level can be increased to 400% without requiring scrolling in more than one direction. This particular example uses percent sizes for the flex items by using the "flex-basis" property and are laid out in source order.</p>

<code>
<pre>
<code>
&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta charset="UTF-8"&gt;
&lt;title&gt;Using CSS Flexbox for Reflow&lt;/title&gt;
&lt;style&gt;
&lt;meta charset="UTF-8"&gt;
&lt;title&gt;Using CSS Flexbox for Reflow&lt;/title&gt;
&lt;style&gt;

/* Reflow Styling */
/* Reflow Styling */

.row {
width: 100%;
display: flex;
flex-flow: row wrap;
}
.row {
width: 100%;
display: flex;
flex-flow: row wrap;
}

.row-nested {
width: calc(100% + 2em);
margin: 0 -1em 1em -1em;
}
.row-nested {
width: calc(100% + 2em);
margin: 0 -1em 1em -1em;
}

.col {
padding: 1em;
flex: 0 1 100%;
}
.col {
padding: 1em;
flex: 0 1 100%;
}

@media all and (min-width: 576px) {
.col-panel {
flex: 0 1 50%;
padding-bottom: 0.25em;
}
@media all and (min-width: 576px) {
.col-panel {
flex: 0 1 50%;
padding-bottom: 0.25em;
}
}

@media all and (min-width: 992px) {
main[role="main"] {
flex: 0 1 66.333333%;
}
aside[role="complementary"] {
flex: 0 1 33.333333%;
margin-top: 0;
}
@media all and (min-width: 992px) {
main[role="main"] {
flex: 0 1 66.333333%;
}
aside[role="complementary"] {
flex: 0 1 33.333333%;
margin-top: 0;
}

&lt;/style&gt;
}

&lt;/style&gt;

&lt;/head&gt;

Expand All @@ -97,6 +98,7 @@ <h3>Example 1: Medium complex flexbox layout in HTML and CSS</h3>
&lt;/div&gt;
&lt;div class="col col-panel"&gt;
...
&lt;/div&gt;
&lt;/div&gt;
&lt;/main&gt;

Expand All @@ -110,32 +112,48 @@ <h3>Example 1: Medium complex flexbox layout in HTML and CSS</h3>

&lt;/body&gt;
&lt;/html&gt;
</code>
</code>
</pre>

<p>Working example: <a href="https://rawgit.com/w3c/wcag/example-css-flexbox/working-examples/css-flexbox/index.html">Using CSS Flexbox for Reflow</a></p>
</section>
</section>
<section id="tests">
<h2>Tests</h2>
<section class="test-procedure">
<h3>Procedure</h3>
<ol>
<li>Display content in a user agent.</li>
<li>Set the viewport width at a equivalent to 320 CSS pixels.</li>
<li>Check whether all content and functionality is available without vertical scrolling.</li>
<li>Set the viewport height at a equivalent to 256 CSS pixels.</li>
<h2>Tests</h2>
<section class="test-procedure">
<h3>Procedure 1</h3>
<ol>
<li>If the text is read horizontally</li>
<li>Display content in a user agent capable of 400% zoom with a viewport-width of 1280 CSS pixels.</li>
<li>Zoom in by 400%.</li>
<li>Check whether all content and functionality is available without horizontal scrolling.</li>
</ol>
</section>
<section class="test-results">
<h3>Expected Results</h3>
<ul>
<li>Check #3 is true.</li>
<li>Check #5 is true.</li>
<p>NB: If the browser is not capable of zooming to 400%, you can reduce the viewport width of the browser proportionally. For example, for 300% zoom set the viewport width at a equivalent to 960 CSS pixels.</p>
</section>
<section class="test-results">
<h3>Expected Results</h3>
<ul>
<li>Check #4 is true.</li>
</ul>
<p>If this is a sufficient technique for a success criterion, failing this test procedure does not necessarily mean that the success criterion has not been satisfied in some other way, only that this technique has not been successfully implemented and can not be used to claim conformance.</p>
</section>
</section>
</section>
<section class="test-procedure">
<h3>Procedure 2</h3>
<ol>
<li>If the text is read vertically.</li>
<li>Display content in a user agent capable of 400% zoom with a viewport-height of 1024 CSS pixels.</li>
<li>Zoom in by 400%.</li>
<li>Check whether all content and functionality is available without vertical scrolling.</li>
</ol>
<p>NB: If the browser is not capable of zooming to 400%, you can reduce the viewport height of the browser proportionally. For example, for 300% zoom set the viewport height at a equivalent to 768 CSS pixels.</p>
</section>
<section class="test-results">
<h3>Expected Results</h3>
<ul>
<li>Check #4 is true.</li>
</ul>
<p>This is a sufficient technique for a success criterion, failing this test procedure does not necessarily mean that the success criterion has not been satisfied in some other way, only that this technique has not been successfully implemented and can not be used to claim conformance.</p>
</section>
</section>
<section id="related">
<h2>Related Techniques</h2>
<ul>
Expand Down

0 comments on commit 656b975

Please sign in to comment.