-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into understanding-cleanup
- Loading branch information
Showing
17 changed files
with
549 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> | ||
<head> | ||
<title>Using CSS Flexbox to reflow content</title> | ||
<link rel="stylesheet" type="text/css" href="https://rawgit.com/w3c/wcag21/master/css/sources.css"/> | ||
</head> | ||
<body> | ||
<h1>Using CSS Flexbox to reflow content</h1> | ||
<section id="meta"> | ||
<h2>Metadata</h2> | ||
<p id="id"></p> | ||
<p id="technology">css</p> | ||
<p id="type">sufficient</p> | ||
</section> | ||
<section id="applicability"> | ||
|
||
</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, 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><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout">Flexbox layouts</a> 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 class="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> | ||
<section class="example"> | ||
<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> | ||
|
||
<pre><code> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Using CSS Flexbox for Reflow</title> | ||
<style> | ||
|
||
/* Reflow Styling */ | ||
|
||
.row { | ||
width: 100%; | ||
display: flex; | ||
flex-flow: row wrap; | ||
} | ||
|
||
.row-nested { | ||
width: calc(100% + 2em); | ||
margin: 0 -1em 1em -1em; | ||
} | ||
|
||
.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: 992px) { | ||
main[role="main"] { | ||
flex: 0 1 66.333333%; | ||
} | ||
aside[role="complementary"] { | ||
flex: 0 1 33.333333%; | ||
margin-top: 0; | ||
} | ||
} | ||
|
||
</style> | ||
|
||
</head> | ||
|
||
<body class="row"> | ||
|
||
<header role="banner" class="col"> | ||
... | ||
</header> | ||
|
||
<main role="main" class="col"> | ||
... | ||
... | ||
<div class="row row-nested"> | ||
<div class="col col-panel"> | ||
... | ||
</div> | ||
<div class="col col-panel"> | ||
... | ||
</div> | ||
</div> | ||
</main> | ||
|
||
<aside role="complementary" class="col"> | ||
... | ||
</aside> | ||
|
||
<footer role="contentinfo" class="col"> | ||
... | ||
</footer> | ||
|
||
</body> | ||
</html></code></pre> | ||
|
||
<p class="working-example">Working example: <a href="../../working-examples/css-flexbox/">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 the web page in a user agent capable of 400% zoom and set the viewport dimensions (in CSS pixels) to 1280 wide and 1024 high.</li> | ||
<li>Zoom in by 400%.</li> | ||
<li>For content read horizontally, check that all content and functionality is available without horizontal scrolling.</li> | ||
<li>For content read vertically, check that all content and functionality is available without vertical scrolling.</li> | ||
</ol> | ||
<p class="note">If the browser is not capable of zooming to 400%, you can reduce the width of the browser proportionally. For example, at 300% zoom the viewport should be sized to 960px wide.</p> | ||
</section> | ||
<section class="test-results"> | ||
<h3>Expected Results</h3> | ||
<p>#3 and #4 are true.</p> | ||
</section> | ||
</section> | ||
<section id="related"> | ||
<h2>Related Techniques</h2> | ||
<ul> | ||
<li><a href="https://w3c.github.io/wcag/techniques/css/C32">Grid reflow technique</a></li> | ||
</ul> | ||
</section> | ||
<section id="resources"> | ||
<h2>Related resources</h2> | ||
<ul> | ||
<li><a href="https://www.w3.org/TR/css-flexbox-1/">CSS Flexible Box Layout Module Level 1</a></li> | ||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout"><abbr title="Mozilla Development Network">MDN</abbr> Flexible Box Layout</a></li> | ||
<li><a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">CSS Tricks Guide to Flexbox</a></li> | ||
</ul> | ||
</section> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> | ||
<head> | ||
<title>Failure of Success Criterion 1.4.4 due to text sized in viewport units</title> | ||
<link rel="stylesheet" type="text/css" href="https://rawgit.com/w3c/wcag21/master/css/sources.css"/> | ||
</head> | ||
<body> | ||
<h1>Failure of Success Criterion 1.4.4 due to text sized in viewport units</h1> | ||
<section id="meta"> | ||
<h2>Metadata</h2> | ||
<p id="id"></p> | ||
<p id="technology">CSS</p> | ||
<p id="type"></p> | ||
</section> | ||
<section id="applicability"> | ||
|
||
</section> | ||
<section id="description"> | ||
<h2>Description</h2> | ||
<p>The objective of this technique is to document the failure of text to re-scale when <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/length">viewport units</a> are used on text. As these units are relative to the viewport, it means they cannot be resized by zooming or adjusting text-size.</p> | ||
<p>There are various methods to increase and decrease the size of text and other content, but viewport units applied to text (generally via <code>font-size</code> in CSS) prevent most available methods. Attempts to use browser controls to zoom or adjust text-size will not work. Only methods that completely override the CSS will work, and those could cause other issues such as layouts collapsing or text overlapping.</p> | ||
|
||
<p class="note">If media queries were used to adjust the size of text or unit of measure at different screen sizes, it may not be a failure of <a href="https://www.w3.org/WAI/WCAG21/Understanding/resize-text.html">Resize text</a>. On-page controls provided by the author are also a way of passing the resize text success criteria.</p> | ||
</section> | ||
<section id="examples"> | ||
<h2>Examples</h2> | ||
<section class="example"> | ||
<h3>Failure example 1</h3> | ||
<p>The following CSS and HTML snippet uses VW units to size the text.</p> | ||
<pre><code>/* CSS */ | ||
.callout { | ||
font-size:1vw; | ||
} | ||
|
||
<p class="callout"> | ||
Text that scales by viewport units<p/></code></pre> | ||
<p class="working-example">Example <a href="../../working-examples/failure-viewport-units/">page with an example of text sized in <code>vh</code> units</a>.</p> | ||
</section> | ||
</section> | ||
<section id="tests"> | ||
<h2>Tests</h2> | ||
<section class="test-procedure"> | ||
<h3>Procedure</h3> | ||
<p>In a desktop browser with a resizable window:</p> | ||
<ol> | ||
<li>Set zoom level to 100%.</li> | ||
<li>Set window size to 1280 pixels wide.</li> | ||
<li>Visit the page to be tested.</li> | ||
<li>Use any of the following methods to resize text when available: | ||
<ul> | ||
<li>the zoom feature of the browser</li> | ||
<li>the text-sizing feature of the browser,</li> | ||
<li>on-page controls for resizing text.</li> | ||
</ul> | ||
</li> | ||
<li>Check that the text resizes by one of the methods above, and can be resized to at least 200% of the default.</li> | ||
</ol> | ||
</section> | ||
<section class="test-results"> | ||
<h3>Expected Results</h3> | ||
<ul> | ||
<li>If step #5 is false, then this failure condition applies and the content fails Success Criteria 1.4.4, Resize Text.</li> | ||
</ul> | ||
</section> | ||
</section> | ||
<section id="related"> | ||
<h2>Related Techniques</h2> | ||
<ul> | ||
<li><a href="../../techniques/general/G179">G179</a></li> | ||
<li><a href="../../techniques/css/C12">C12</a></li> | ||
<li><a href="../../techniques/css/C13">C13</a></li> | ||
<li><a href="../../techniques/css/C14">C14</a></li> | ||
</ul> | ||
</section> | ||
<section id="resources"> | ||
<h2>Related Resources</h2> | ||
<ul> | ||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/length"><abbr title="Mozilla Development Network">MDN</abbr> CSS units</a> including <code>vh</code> and <code>vw</code> units.</li> | ||
<li><a href="https://www.w3.org/TR/css-values/#viewport-relative-lengths">Viewport percentage lengths</a> in the CSS Values and Units Module Level 4 specification.</li> | ||
</ul> | ||
</section> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> | ||
<head> | ||
<title>Using HTML 5.2 autocomplete attributes</title> | ||
<link rel="stylesheet" type="text/css" href="https://rawgit.com/w3c/wcag21/master/css/sources.css"/> | ||
</head> | ||
<body> | ||
<h1>Using HTML 5.2 autocomplete attributes</h1> | ||
<section id="meta"> | ||
<h2>Metadata</h2> | ||
<p id="id"></p> | ||
<p id="technology">html. It should also be noted that as of the summer 2018, neither Edge nor IE support the functionality found in Chrome, Firefox or Safari with regard to auto-filling the form inputs.</p> | ||
<p id="type">sufficient</p> | ||
</section> | ||
<section id="applicability"> | ||
<h2>When to Use</h2> | ||
<p>All HTML form fields that map to the <a href="https://www.w3.org/TR/WCAG21/#input-purposes">HTML 5.2 autofill tokens</a>.</p> | ||
</section> | ||
<section id="description"> | ||
<h2>Description</h2> | ||
|
||
<p>The objective of this technique is to programmatically link a pre-defined and published taxonomic term to the input, so that the inputs can also be machine-interpreted. This way the input will always have a common, referable and identifiable value associated to it, no matter what language is used, or what visible on-screen term is used to label the input. Then it can be further customized or otherwise machine-manipulated to help users.</p> | ||
|
||
<p>The technique works by adding the appropriate autocomplete token to each form field on the form to make the identified inputs Programmatically Determinable. This will help people with cognitive disabilities who may not immediately know the purpose of the field because the label used by the author is not familiar to them. When inputs have been programmatically assigned, third party plugins and software can manipulate these form fields to make them more accessible to people with cognitive disabilities. For instance, a plugin could detect an autocomplete token with the text string "tel" and insert a telephone icon. It will further enable third party software to swap out the existing labels for text labels that the user finds more familiar. For instance, it could change "Given Name" to "First Name".</p> | ||
|
||
<p>The <code>autocomplete</code> attribute also improves the browser's ability to pre-populate form fields with user-preferred values. When the input has been properly 'tagged' with the known token value, the value entered by the user is stored locally on the host machine and associated with the token value for reuse. It helps those with dexterity disabilities who have trouble typing, those who may need more time, and anyone who wishes to reduce effort to fill out a form.</p> | ||
|
||
<p>The <code>autocomplete</code> attribute allows the browser to do a pattern match against a list of values locally stored with the browser, and supplies the appropriate corresponding value when the input is programmatically tagged. This is a User setting that can be turned on or off, or modified by the end user. This reduces typing and reliance on memory because it uses stored values to fill in the fields.</p> | ||
|
||
<p>It's important to note the success criterion <a href="identify-input-purpose">Identify Input Purpose</a> and autocomplete attribute only place requirements on input fields collecting information <em><strong>about the user</strong></em>.</p> | ||
|
||
<p>For the success criterion, it is assumed that the <code>autocomplete</code> attribute is not used on form fields that do not correspond to an autocomplete field described in the <a href="https://www.w3.org/TR/html52/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute">HTML 5.2 specification</a>. If the <code>autocomplete</code> field is used to describe a "custom" taxonomy, rather than that described in the specification, this rule may produce incorrect results. </p> | ||
</section> | ||
<section id="examples"> | ||
<h2>Examples</h2> | ||
<section class="example"> | ||
<h3>Example 1: Currency</h3> | ||
<p>This is a simple form that collects contact and credit card information from the user.</p> | ||
<pre><code><form method="post" action="step2"> | ||
<div> | ||
<label for="fname">First Name</label> | ||
<input id="fname" type="text" <strong>autocomplete="given-name"</strong> ... > | ||
</div> | ||
<div> | ||
<label for="lname">Last Name Name</label> | ||
<input id="lname" type="text" <strong>autocomplete="family-name"</strong> ... > | ||
<label for="cc-num">Credit card number:</label> | ||
<input type="text" id="cc-num" <strong>autocomplete="cc-number"</strong>> | ||
</div> | ||
<div> | ||
<label for="exp-date">Expiry Date:</label> | ||
<input type="month" id="exp-date" <strong>autocomplete="cc-exp"</strong>> | ||
</div> | ||
<div> | ||
<input type="submit" value="Continue..."> | ||
</div> | ||
</form></code></pre> | ||
</section> | ||
</section> | ||
|
||
<section id="tests"> | ||
<h2>Tests</h2> | ||
<section class="test-procedure"> | ||
<h3>Procedure</h3> | ||
<p>For each form field that collects information about the user and corresponds to an autocomplete field described in <a href="https://www.w3.org/TR/WCAG21/#input-purposes">WCAG 2.1 7. Section 7: Input Purposes for User Interface Components</a>, check the following:</p> | ||
<ol> | ||
<li>The form field has a valid and well-formed autocomplete attribute and value pair.</li> | ||
<li>The purpose of the form field indicated by the label corresponds with the autocomplete token on the input.</li> | ||
</ol> | ||
</section> | ||
<section class="test-results"> | ||
<h3>Expected Results</h3> | ||
<ul> | ||
<li>If #1 and #2 are true, then the test passes and the technique has been successfully implemented</li> | ||
</ul> | ||
</section> | ||
</section> | ||
<section id="related-resources"> | ||
<h2>Related Resources</h2> | ||
<ul> | ||
<li>Autocomplete test in the <a href="https://github.com/auto-wcag/auto-wcag/pull/170/files#diff-975065c206dc7448c6810fcbba89923b">automated test suite.</a> [@@ will update to published link when available]</li> | ||
</ul> | ||
</section> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.