From ca90fe37d0ab9985e936cb7649e620bf8de962fa Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 13:17:26 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20Add=20explicit=20inst?= =?UTF-8?q?ructions=20and=20improve=20screen=20reader=20a11y=20for=20score?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: EiJackGH <172181576+EiJackGH@users.noreply.github.com> --- .Jules/palette.md | 3 +++ src/views/mario-game.njk | 23 +++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.Jules/palette.md b/.Jules/palette.md index 8ee612f..c4219a5 100644 --- a/.Jules/palette.md +++ b/.Jules/palette.md @@ -12,3 +12,6 @@ ## 2025-03-23 - Game Key Scrolling **Learning:** Browsers natively scroll the page when users press Space or Arrow keys. When building a web-based game, this creates a frustrating UX where the game viewport jumps around while playing. **Action:** Always call `e.preventDefault()` on keydown events for typical game controls ("Space", "ArrowUp", etc.) when the focus is on a game container or the body. +## 2026-07-14 - Adding explicit instructions to interactive canvas +**Learning:** When building interactive HTML5 widgets or games with custom keyboard event bindings that aren't native UI controls, users and screen readers lack affordances to know how to interact. Also, floating UI instructions must not block clicks. +**Action:** Always provide explicit, visible instructional text for custom controls, separate static labels from aria-live dynamic content, and use `pointer-events: none` on floating instruction overlays. diff --git a/src/views/mario-game.njk b/src/views/mario-game.njk index 67b6bd7..db1e8b4 100644 --- a/src/views/mario-game.njk +++ b/src/views/mario-game.njk @@ -44,7 +44,7 @@ background: #2ecc71; } - #score { + #score-container { position: absolute; top: 10px; left: 10px; @@ -52,13 +52,28 @@ font-size: 20px; font-family: Arial; } + + #instructions { + position: absolute; + bottom: 60px; + left: 50%; + transform: translateX(-50%); + color: white; + font-size: 16px; + font-family: Arial; + background: rgba(0, 0, 0, 0.5); + padding: 5px 10px; + border-radius: 5px; + pointer-events: none; + }
-
Score: 0
+
Score: 0
+
Press Space or Up Arrow to jump
@@ -66,7 +81,7 @@