From 307c742464fe1fcabaac802266d28b9d66a8dfdb Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 13:24:17 +0000 Subject: [PATCH] Refactor dynamic score display to use aria-live region Co-authored-by: EiJackGH <172181576+EiJackGH@users.noreply.github.com> --- .Jules/palette.md | 4 ++++ src/views/mario-game.njk | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.Jules/palette.md b/.Jules/palette.md index 4e5ec39..3751230 100644 --- a/.Jules/palette.md +++ b/.Jules/palette.md @@ -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. diff --git a/src/views/mario-game.njk b/src/views/mario-game.njk index 1f2f7f5..6d93deb 100644 --- a/src/views/mario-game.njk +++ b/src/views/mario-game.njk @@ -68,7 +68,7 @@
-
Score: 0
+
Score: 0
Press Space or ↑ to jump!
@@ -77,7 +77,7 @@