Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@
## 2025-07-31 - Explicit Game Controls
**Learning:** When building interactive HTML5 widgets or games with custom keyboard event bindings, users may not intuitively know which keys to press, leading to confusion.
**Action:** Always provide explicit, visible instructional text for custom keyboard controls so users know the required inputs.

## 2024-08-05 - Accessible Dynamic Scores
**Learning:** Dynamic text changes, like game scores, are invisible to screen readers unless explicitly marked. However, placing static text (like "Score:") inside an `aria-live` region forces screen readers to unnecessarily repeat it.
**Action:** Add `aria-live="polite"` only to the container of the dynamic value, extracting static text into a separate sibling element.
6 changes: 3 additions & 3 deletions src/views/mario-game.njk
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<body>

<div id="game">
<div id="score">Score: 0</div>
<div id="score"><span id="score-label">Score: </span><span id="score-val" aria-live="polite">0</span></div>
<div id="instructions">Press Space or ↑ to jump!</div>
<div id="mario"></div>
<div class="ground"></div>
Expand All @@ -77,7 +77,7 @@
<script>
const mario = document.getElementById("mario");
const game = document.getElementById("game");
const scoreText = document.getElementById("score");
const scoreText = document.getElementById("score-val");

let jumping = false;
let score = 0;
Expand Down Expand Up @@ -129,7 +129,7 @@
clearInterval(move);
goomba.remove();
score++;
scoreText.innerText = "Score: " + score;
scoreText.innerText = score;
} else {
position -= 6;
goomba.style.left = position + "px";
Expand Down