Accessibility: keyboard move entry and screen reader support (#72) (#115)

* commented out lesson and learning strip until lessons are established

* reword the hero section

* change layout and working on puzzle section - remove top div as it was
redundant

* amend flash message on replay

* switch cancel session for return home

* remove system theme toggle since this is the default, leaving only light
and dark toggles

* add keyboard and screen reader support for play (#72)

First draft covering the accessibility work in #72:\n\n- labelled SAN/UCI move input, validated against the tablebase and applied\n  by the board hook, plus an accessible promotion picker\n- live-region announcements for moves, checks, checkmates and solve/fail,\n  and a hidden text summary of the position\n- accessible labels, focus ring, skip link, keyboard-friendly review table\n  and non-colour grade cues\n- WCAG AA text contrast roles and a responsive play surface\n- regression tests for move entry, announcements and link-style CTAs
This commit is contained in:
2026-11-09 12:09:07 +01:00
committed by GitHub
parent 8df7ac982c
commit 805c2f1150
31 changed files with 812 additions and 136 deletions
@@ -69,7 +69,7 @@ defmodule ChesstrainerWeb.PageControllerTest do
refute html =~ "Phoenix Framework"
eyebrow = LazyHTML.query(document, ".eyebrow")
assert LazyHTML.text(eyebrow) =~ "Endgames, made clear"
assert LazyHTML.text(eyebrow) =~ "Endgames, simplified"
assert LazyHTML.attribute(LazyHTML.query(eyebrow, "svg"), "aria-hidden") == ["true"]
assert LazyHTML.attribute(LazyHTML.query(document, ~s(meta[name="description"])), "content") ==
@@ -216,19 +216,13 @@ defmodule ChesstrainerWeb.PageControllerTest do
refute html =~ ~p"/users/register"
end
test "renders curated cards and the daily board", %{conn: conn} do
{beginner, intermediate, advanced} = curated!()
test "renders the daily board", %{conn: conn} do
curated!()
daily = DailyPuzzles.today()
html = conn |> get(~p"/") |> html_response(200)
document = LazyHTML.from_document(html)
assert LazyHTML.attribute(LazyHTML.query(document, ".puzzle-card"), "href") == [
"/endgames/#{beginner.public_code}/play",
"/endgames/#{intermediate.public_code}/play",
"/endgames/#{advanced.public_code}/play"
]
board = LazyHTML.text(LazyHTML.query(document, ".board-caption"))
assert board =~ daily.key
@@ -238,7 +232,6 @@ defmodule ChesstrainerWeb.PageControllerTest do
assert LazyHTML.text(LazyHTML.query(document, ".board-topline")) =~ "White"
assert html =~ "Try today's puzzle"
assert html =~ "<span>puzzles</span>"
end
test "hero CTA links to the daily puzzle", %{conn: conn} do
@@ -274,7 +267,6 @@ defmodule ChesstrainerWeb.PageControllerTest do
document = LazyHTML.from_document(html)
assert html =~ "Featured position"
assert html =~ "<span>puzzles</span>"
refute html =~ "puzzle-card"
assert LazyHTML.attribute(LazyHTML.query(document, ".hero-actions a"), "href") == [