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
3 changes: 3 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@
## 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-05-24 - Dynamic Score Announcement
**Learning:** Dynamic text changes like game scores are invisible to screen readers unless explicitly marked. Also, static text should not be inside an aria-live region to avoid repetition.
**Action:** Extract static text and add aria-live="polite" to the container of the dynamic value.
11 changes: 7 additions & 4 deletions src/views/mario-game.njk
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
background: #2ecc71;
}

#score {
#score-container {
position: absolute;
top: 10px;
left: 10px;
Expand All @@ -68,7 +68,10 @@
<body>

<div id="game">
<div id="score">Score: 0</div>
<div id="score-container">
<span>Score: </span>
<span id="score-value" 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 +80,7 @@
<script>
const mario = document.getElementById("mario");
const game = document.getElementById("game");
const scoreText = document.getElementById("score");
const scoreText = document.getElementById("score-value");

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