Skip to content

Stepper keys, screen-reader narration and native dark controls - #3

Merged
devmtnaing merged 1 commit into
mainfrom
stepper-keyboard-a11y
Sep 28, 2026
Merged

devmtnaing merged 1 commit into
mainfrom
stepper-keyboard-a11y

Conversation

@devmtnaing

Copy link
Copy Markdown
Owner

What this changes

Three fixes from a UI/UX review of the x-sum page. They live in the shared stepper and theme tokens, so all 46 lessons get them; no lesson file changed.

Keyboard (src/lib/stepper.js)

  • Space presses the focused control. Previously, while the walkthrough was on screen, Space on a focused Next, Copy or disclosure toggled playback instead. Space now only plays or pauses when no control has focus.
  • Modified keys go to the browser. Alt/Ctrl/Cmd + arrow was being swallowed, which broke Alt+← (Back).
  • Tabs follow the ARIA tabs pattern. On the approach tabs and both language tab rows, ←/→/Home/End move to a tab and select it (→ on a tab used to step the walkthrough). A roving tabindex leaves only the selected tab in the Tab order.
  • ←/→ on a focused button (for example right after clicking Next) still step, as before.

Screen readers (src/lib/stepper.js)

  • The narration (tag + text) is an aria-live="polite" region, so each step is read when you move to it. It goes quiet during autoplay, since a step every 700 ms would pile up, and speaks again on pause.
  • The scrubber has an aria-valuetext such as "Step 2 of 12: tally" (with a Burmese version) instead of a bare index.

Dark theme (src/styles/tokens.css)

  • color-scheme is set for the light, system-dark and forced-dark states. Scrollbars, range tracks and number spinners now draw dark on the dark theme; the mobile array strip used to show a white scrollbar.

Checked

  • npm run check: 46 lessons, 0 failures.
  • npm run build, then npm run audit (axe in both themes): passed, 46 pages.
  • A one-off Playwright run pressing real keys on every lesson:
    • Space on Next; Alt+→; → on a button.
    • Arrows/Home/End on the approach tabs, and → on the Part 3 language tabs (both rows and the visible pane stay in sync).
    • Space to play and pause while watching the live region.
    • One Tab stop per tab row, the scrubber's spoken value, and color-scheme in all three theme states.
    • Result: 46/46 passed, 0 page errors.

- Space on a focused button, link or disclosure presses it instead of
  toggling playback; Alt/Ctrl/Cmd combos go to the browser (Alt+← is Back).
- Approach and language tabs take ←/→/Home/End and use a roving tabindex,
  so only the selected tab is a Tab stop.
- The narration is a polite live region, muted while autoplay runs; the
  scrubber announces "Step 2 of 12: tally" via aria-valuetext.
- tokens.css sets color-scheme per theme, so scrollbars, range tracks and
  spinners are drawn dark on the dark theme.
@coderabbitai

coderabbitai Bot commented Sep 26, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 979639ef-668d-469d-bfe5-f034016255d7


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 5d42942 2026-09-26T19:22:20.172Z Visit the dashboard ↗

@devmtnaing
devmtnaing merged commit 08fecc9 into main Sep 28, 2026
101 of 102 checks passed
devmtnaing added a commit that referenced this pull request Sep 28, 2026
lesson-kit.md now describes the page as it is after #3-#9 (LeetCode links
past a divider, the sticky transport and wrapping strip, part 3 folding to
the chosen approach) and adds the rules a lesson can still break:
- mode ids and control keys are in every shared link; parse(format(v))
  must give back v
- a rejection message is a short phrase
- modes[0] is what 2·2 and part 3 open on
- a custom stage's headings are <h5 class="as-h3">
- empty says what it waits for; slots()/blank()/stageEmpty(), and a dot
  only as notation
- a widget's own clickable elements are 40px tall on touch

SKILL.md gains one judgement call: a kit change is measured on every
lesson before choosing, with a before/after when it changes how pages look.
devmtnaing added a commit that referenced this pull request Sep 28, 2026
* Skill: what the UI/UX review changed for a lesson author

lesson-kit.md now describes the page as it is after #3-#9 (LeetCode links
past a divider, the sticky transport and wrapping strip, part 3 folding to
the chosen approach) and adds the rules a lesson can still break:
- mode ids and control keys are in every shared link; parse(format(v))
  must give back v
- a rejection message is a short phrase
- modes[0] is what 2·2 and part 3 open on
- a custom stage's headings are <h5 class="as-h3">
- empty says what it waits for; slots()/blank()/stageEmpty(), and a dot
  only as notation
- a widget's own clickable elements are 40px tall on touch

SKILL.md gains one judgement call: a kit change is measured on every
lesson before choosing, with a before/after when it changes how pages look.

* Audit: guard what the UI/UX review fixed

npm run audit now also fails a page when:
- a heading skips a level on any step
- an answer slot, empty-stage note or ledger shows only a dot or dash
  (a dot in a stage cell is notation and allowed)
- anything scrolls sideways at 320px (one code language; 400px keeps
  walking all of them)
- space on a focused Next starts playback instead of pressing it, or → on
  an approach tab steps instead of moving between tabs
- an untouched page has a query, a shared link reopens a different
  approach, step, code language, Part 3 pane or input, or "Report an
  issue" names a different state

Repeats collapse to one line per approach, naming the first step. Each
check was confirmed to fail with its fix reverted. CONTRIBUTING.md and the
skill describe the new checks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant