Last active
December 9, 2018 15:50
-
-
Save ChrisBAshton/e6f4a4fe5ee25abb099c44cd26a8e2c6 to your computer and use it in GitHub Desktop.
Screen reader gists
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
<label> | |
Important: We can only hold details of one trip at a time. | |
<input type="checkbox" /> Tick to confirm you have read this. * | |
</label> |
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
<style> | |
.off-screen { | |
clip: rect(0 0 0 0); | |
clip-path: inset(100%); | |
height: 1px; | |
overflow: hidden; | |
position: absolute; | |
white-space: nowrap; | |
width: 1px; | |
} | |
</style> | |
<a href="/tweets/123/like"> | |
<span class="off-screen">1,887 users like this tweet. Click to like</span> | |
<span aria-hidden="true">1,887</span> | |
</a> |
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
<div role="region" aria-live="polite" class="off-screen" id="search-status"></div> | |
<form id="search-form"> | |
<label> | |
<span class="off-screen">Search for a video</span> | |
<input type="text" /> | |
</label> | |
<input type="submit" value="Search" /> | |
</form> | |
<script> | |
document.getElementById('search-form').addEventListener('submit', function (e) { | |
e.preventDefault(); | |
ajaxSearchResults(); // not defined here, for brevity | |
document.getElementById('search-status').textContent = 'Search submitted. Navigate to results below.'; // announce to screen reader | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment