Skip to content

Commit

Permalink
Working examples bug fixes (#3970)
Browse files Browse the repository at this point in the history
Various fixes including:

1. Adding `lang` attributes to `html` elements
2. Giving accessible names to `input` elements
3. Updating `doctype`s
4. Fixing a broken link
5. Updating a remote jQuery library call to a non 1.x version that's
served over `https`
  • Loading branch information
fstrr authored Sep 13, 2024
1 parent 1258d74 commit 4fa3c49
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 38 deletions.
6 changes: 3 additions & 3 deletions techniques/aria/ARIA9.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h3>A conference workshop booking table</h3>
&lt;table&gt;
&lt;caption&gt;Dinosaur Conference workshop booking table&lt;/caption&gt;
&lt;tr&gt;
&lt;td rowspan="2"&gt;&lt;/td&gt;
&lt;th rowspan="2" scope="col"&gt;Track&lt;/th&gt;
&lt;th colspan="2" scope="colgroup"&gt;Thursday&lt;/th&gt;
&lt;th colspan="2" scope="colgroup"&gt;Friday&lt;/th&gt;
&lt;/tr&gt;
Expand All @@ -70,7 +70,7 @@ <h3>A conference workshop booking table</h3>
&lt;th scope="col" id="pm2"&gt;2 to 5 PM&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th id="track1" scope="row"&gt;track 1&lt;/th&gt;
&lt;th id="track1" scope="row"&gt;Track 1&lt;/th&gt;
&lt;td&gt;
&lt;h2 id="title-TM1"&gt;The Paleozoic era &lt;/h2&gt;
&lt;p&gt;2 places left&lt;/p&gt;
Expand All @@ -97,7 +97,7 @@ <h3>A conference workshop booking table</h3>
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th id="track2" scope="row"&gt;track 2&lt;/th&gt;
&lt;th id="track2" scope="row"&gt;Track 2&lt;/th&gt;
&lt;td&gt;
&lt;h2 id="title-TM2"&gt;The Cretaceous period&lt;/h2&gt;
&lt;p&gt;18 places left&lt;/p&gt;
Expand Down
27 changes: 23 additions & 4 deletions working-examples/aria-alert-identify-errors/index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
<!doctype html>
<html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Using role=alert to Identify Errors</title>
<script src="http://code.jquery.com/jquery.js"></script>
<title>Using ARIA live regions or role=alert to identify errors</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<style>
body{
background:#fff;
color:#000;
font-family:system-ui;
}

input{
border:1px solid #000;
font:inherit;
}

[type=submit]{
background: #666;
color:#fff;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>

<script>
$(document).ready(function(e) {
$('#signup').submit(function() {
Expand Down Expand Up @@ -50,7 +69,7 @@
</head>

<body>
<h1>Using ARIA Live Regions or role=alert to Identify Errors</h1>
<h1>Using ARIA live regions or <code class="language-html">role=alert</code> to identify errors</h1>
<form name="signup" id="signup" method="post" action="">
<p id="errors" role="alert" aria-atomic="true"></p>
<p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>aria-labelledby example 1: Extend time-out</title>

<meta content="charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>aria-labelledby example 1: Extend time-out</title>
<style>
body{
background:#fff;
color:#000;
font-family: system-ui;
}
</style>
</head>

<body>

<h2>Extend timeout</h2>
<h1><code class="language-html">aria-labelledby</code> example 1: Extend time-out</h1>

<form>
<p><span id="timeout-label"><label for="timeout-duration">Extend time-out to</label></span>
Expand All @@ -18,6 +24,6 @@ <h2>Extend timeout</h2>
</form>


<p>(Adapted from <a href="http://www.marcozehe.de/2008/03/23/easy-aria-tip-2-aria-labelledby-and-aria-described">Easy ARIA tip #2: aria-labelledby and aria-describedby</a>, an example put together by Marco Zehe in 2008)</p>
<p>(Adapted from <a href="https://www.marcozehe.de/easy-aria-tip-2-aria-labelledby-and-aria-describedby/">Easy ARIA tip #2: aria-labelledby and aria-describedby</a>, an example put together by Marco Zehe in 2008)</p>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta charset="utf-8"/>
<title>Dinosaur conference</title>
</head>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<style>
body{
background:#fff;
color:#000;
font:1rem / 1.5 system-ui;
}

table{
border:1px solid hsl(0, 0%, 0%);
border-collapse:collapse;
margin-block-end:1rem;
}
th, td{
border:1px solid;
}

input[type=submit]{
font:inherit;
}
</style>
</head>
<body>
<h1>Dinosaur conference workshops timetable Thursday, 14. & Friday, 15. March 2013</h1>

Expand All @@ -13,7 +34,7 @@ <h1>Dinosaur conference workshops timetable Thursday, 14. & Friday, 15. March 2
Dinosaur conference workshop booking table
</caption>
<tr>
<td rowspan="2"></td>
<th rowspan="2" scope="col">Track</th>
<th colspan="2" scope="colgroup">Thursday</th>
<th colspan="2" scope="colgroup">Friday</th>
</tr>
Expand All @@ -26,12 +47,12 @@ <h1>Dinosaur conference workshops timetable Thursday, 14. & Friday, 15. March 2
</tr>

<tr>
<th id="track1" scope="row">track 1</th>
<th id="track1" scope="row">Track 1</th>
<td>
<h2 id="title-TM1">The Paleozoic era </h2>
<h2 id="title-TM1">The Paleozoic era</h2>
<p>2 places left</p>
<p><input type="checkbox" id="TM1" aria-labelledby="title-TM1 track1 am1 TM1-att">
<label id="TM1-att" for="TM1">Attend</label></p>
<label id="TM1-att" for="TM1">Attend</label></p>
</td>

<td>
Expand Down Expand Up @@ -59,7 +80,7 @@ <h2 id="title-FA1">The Jurassic period</h2>


<tr>
<th id="track2" scope="row">track 2</th>
<th id="track2" scope="row">Track 2</th>
<td>
<h2 id="title-TM2">The Cretaceous period</h2>
<p>18 places left</p>
Expand Down Expand Up @@ -89,16 +110,14 @@ <h2 id="title-FA2">Emerging scholarship </h2>
</td>
</tr>
</table>
<p>&nbsp;</p>
<table role="presentation" cellspacing="0" cellpadding="4" border="0">
<table role="presentation" cellspacing="0" cellpadding="4">
<tr>
<td><label for="123">Maiden Name:</label></td>
<td>
<input type="text" maxlength="255" size="30" id="123" value="" name="maidenName" aria-describedby="986">
<span id="986">(Only enter if different from last name) </span>
</td>
</table>
<p>&nbsp;</p>
<input type="submit" value="Log in">
</body>
</html>
25 changes: 18 additions & 7 deletions working-examples/device-motion-sensor-input-failure/index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<style type="text/css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<style>
body{
background: #fff;
color:#000;
font-family:system-ui;
}

.slidecontainer {
width:100%;
}
button{
font:inherit;
}

.slidecontainer {
width:100%;
}
</style>

<title>WCAG Failure Example of Motion Sensor</title>
Expand All @@ -14,14 +25,14 @@

<pre class="output"></pre>

<h1>Slider Motion Sensor Failure Example </h1>
<h1>Slider Motion Sensor Failure Example</h1>

<p>Open this slider on a device with a motion sensor, such as a smart phone or tablet. Tilt the device to the right and left to adjust the slider value. The decrease and increase buttons also adjust the value. There is no way to deactivate the motion sensor. </p>
<p>Note: This example may not work across all browsers.</p>

<div class="slidecontainer">
<button type="button" name="decrease" onclick="decreaseFunction()">Decrease Value</button>
<input type="range" min="1" max="100" value="50" class="slider" id="motionSlider">
<input aria-label="demo slider" type="range" min="1" max="100" value="50" class="slider" id="motionSlider">
<button type="button" name="increase" onclick="increaseFunction()">Increase Value</button>
<p aria-live="polite">Slider Value: <span id="demo"></span></p>
</div>
Expand Down
22 changes: 16 additions & 6 deletions working-examples/device-motion-sensor-input/index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<style type="text/css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<style>
body{
background: #fff;
color:#000;
font-family:system-ui;
}

.slidecontainer {
button{
font:inherit;
}
.slidecontainer {
width:100%;
}
}
</style>

<title>WCAG Example of Motion Sensor</title>
Expand All @@ -14,14 +24,14 @@

<pre class="output"></pre>

<h1>Slider Motion Sensor Example </h1>
<h1>Slider Motion Sensor Example</h1>

<p>Open this slider on a device with a motion sensor, such as a smart phone or tablet. Tilt the device to the right and left to adjust the slider value. The decrease and increase buttons also adjust the value. The check box disables the motion sensing adjustment.</p>
<p>Note: This example may not work across all browsers.</p>

<div class="slidecontainer">
<button type="button" name="decrease" onclick="decreaseFunction()">Decrease Value</button>
<input type="range" min="1" max="100" value="50" class="slider" id="motionSlider">
<input aria-label="demo slider" type="range" min="1" max="100" value="50" class="slider" id="motionSlider">
<button type="button" name="increase" onclick="increaseFunction()">Increase Value</button>
<p aria-live="polite">Slider Value: <span id="demo"></span></p>
</div>
Expand Down

0 comments on commit 4fa3c49

Please sign in to comment.