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 @@ -19,3 +19,7 @@
## 2024-08-06 - Screen Reader Accessible Dynamic Text
**Learning:** Dynamic text changes, like game scores, are invisible to screen readers unless explicitly marked. Do not place static text (like instructions) inside an `aria-live` region, as it forces screen readers to unnecessarily repeat the static text every time the dynamic content updates. Extract static text into a separate sibling element.
**Action:** Add `aria-live="polite"` to the container of the dynamic value and extract static text out of it.

## 2024-05-18 - Keyboard Shortcut Discoverability
**Learning:** Explicitly highlighting keyboard shortcuts using semantic <kbd> tags with physical key styling improves intuitiveness and discoverability. Always wrap key shortcuts in <kbd> and apply text-shadows to ensure high contrast against dynamic backgrounds.
**Action:** Always wrap key shortcuts in <kbd> and apply text-shadows to ensure high contrast against dynamic backgrounds.
14 changes: 13 additions & 1 deletion src/views/mario-game.njk
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,26 @@
font-family: Arial;
pointer-events: none;
}

kbd {
background-color: #f7f7f7;
color: #333;
border: 1px solid #ccc;
border-radius: 4px;
padding: 2px 6px;
box-shadow: 0 2px 0 #ccc;
font-family: monospace;
font-size: 14px;
text-shadow: 0 1px 0 #fff;
}
</style>
</head>

<body>

<div id="game">
<div id="score-container">Score: <span id="score-value" aria-live="polite">0</span></div>
<div id="instructions">Press Space or ↑ to jump!</div>
<div id="instructions">Press <kbd>Space</kbd> or <kbd>↑</kbd> to jump!</div>
<div id="mario"></div>
<div class="ground"></div>
</div>
Expand Down