Skip to content

Commit

Permalink
improve die accessibility for screen readers
Browse files Browse the repository at this point in the history
  • Loading branch information
tasxatzial committed Jun 17, 2024
1 parent c136e57 commit 7025afe
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<body>
<h1>Roll the dice</h1>
<div class="die-container">
<button aria-label="die" class="die-button"></button>
<span class="sr-only die-result" aria-live="polite"></span>
<button aria-label="die" class="die-button js-die-button" aria-labelledby="die-result"></button>
<span hidden id="die-result" class="js-die-result"></span>
</div>
</body>
</html>
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const dieButton = document.querySelector('.die-button');
const dieResult = document.querySelector('.die-result');
const dieButton = document.querySelector('.js-die-button');
const dieResult = document.querySelector('.js-die-result');
dieButton.addEventListener('click', () => render(getRandomNumber()));

/* initial render */
Expand Down
12 changes: 0 additions & 12 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,6 @@ body {
font-family: sans-serif;
}

.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}

h1 {
font-size: 2.5rem;
text-align: center;
Expand Down

0 comments on commit 7025afe

Please sign in to comment.