Skip to content

Editor UI: accessibility fixes and a pass over the chrome - #31

Merged
ChrisMayfield merged 10 commits into
mainfrom
ui-polish
Aug 15, 2026
Merged

ChrisMayfield merged 10 commits into
mainfrom
ui-polish

Conversation

@ChrisMayfield

Copy link
Copy Markdown
Member

Ten commits of editor UI work: accessibility fixes first (text size, contrast, landmarks and headings), then a pass over the editor chrome (labels, tooltips, toolbar styling, console toggle).

Accessibility

  • Hold UI text to a 13px floor — raise --text-xs 12px → 13px and replace the 36 text-[9px]–text-[13px] utilities with it. Settings → text size now steps 1px from 13–19 (default 16) and stores the pixel size itself, reading old 1–5 positions back through the previous mapping. Deletes the inert tailwind.config.js. Guarded by tests/text-size.test.ts.
  • Give muted text a color that clears WCAG AA — text-slate-500 failed 4.5:1 on every surface we paint it on. Adds a dedicated muted token at oklch(66% 0.046 257.4) rather than flattening ~60 call sites into slate-400, plus three hover-state failures a static scan misses. Guarded by tests/color-contrast.test.ts, which recomputes the ratios from the oklch values.
  • Give every page a main landmark and an h1 — the editor, embed player, and account page each lacked a heading or a landmark, so "jump to main" and "list headings" came up empty. With the contrast fixes, axe reports no violations across the editor (including panels, menus, and blocks), the account page, and the embed player.

Editor chrome

  • Move the AST button to the bottom and call it Parse Tree — it's a debugging view, not a translation target, so it sits with the AI Assistant below the divider. LANG_LABELS.ast becomes "Parse Tree"; the tooltip keeps "(AST)" discoverable.
  • Make the whole console bar toggle it, and remember that state — one consistent affordance in both states, with aria-expanded and keyboard handling. Persists as showOutput in praxly-editor-state; older saved sessions open as before.
  • Confirm before Clear, and hide the button for now — Clear routes through the same discard modal as Demo and Examples, and all three now say how to undo. The button is behind a false && guard; the handler and modal stay wired up.
  • Restyle the editor toolbar buttons — shared secondaryBtn treatment across Demo/Examples/Settings/Share, consistent hover direction, "Run Code" → "Run". The Selenium harness now finds Run by aria-label.
  • Add tooltips to the rest of the editor chrome — source-language picker, console header, and pane close buttons.

Also drops the chromedriver dependency and its overrides, and settles spelling on US outside Blockly's own API (colour/colourPrimary stay, with a note saying why).

Testing

npm run build clean and npm run test:run green (560 passed, 4 skipped, 17 files) on the branch head. The axe sweeps described above were done when those commits were written, not re-run here. npm run test-browser (Selenium) has not been run.

🤖 Generated with Claude Code

ChrisMayfield and others added 10 commits August 14, 2026 19:58
Small text was scattered across the UI at 9-13px, well under a
comfortable reading size. Raise the smallest type-scale step and pull the
stragglers back onto it.

Tailwind v4 keeps the scale in CSS variables, so the floor is one
override in the @theme block: --text-xs goes 12px -> 13px. Every other
token keeps its stock value, and text-base stays the conventional
1rem/16px — shifting the whole ramp would make sm/base disagree with
Tailwind's own docs and with any component pasted in from elsewhere.
--text-xs--line-height is left alone because Tailwind stores it as a
unitless ratio, so leading follows the new size on its own.

That variable cannot reach arbitrary sizes, so replace the 36
text-[9px]/[10px]/[11px]/[13px] utilities with the text-xs token, and fix
the two places that set a small font outside Tailwind entirely: the
output console's fallback, and Blockly tooltips, which subtracted 2px and
so were always the smallest text on screen.

tests/text-size.test.ts guards both halves — it fails on any arbitrary
size below 13px and on a --text-xs that drops under it.

Also rework Settings -> text size to step 1px from 13 to 19 (default 16)
instead of 2px from 12 to 20. With 1px steps the position->px mapping
earns nothing, so the slider's value is now the pixel size itself. That
changes what praxly-text-size means in localStorage, so a stored 1-5
position is read back through the old mapping rather than being taken
literally as a 1-5px font.

Delete tailwind.config.js: v4 only loads a JS config when a stylesheet
asks for one with @config, and index.css never does, so it has been inert
since the v4 upgrade.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
text-slate-500 was the app's muted / secondary-label color, and it fails
the 4.5:1 contrast floor on every surface we paint it on: 4.23:1 on
slate-950, 3.74:1 on slate-900, 3.07:1 on slate-800. text-slate-600, used
for a couple of empty-state lines, is worse at 2.36:1. Axe DevTools
flags each one it can see.

Swapping all ~60 call sites to slate-400 would clear the floor but
flatten muted text into the tier directly above it, so the muted tier
gets its own @theme token instead — same slate hue and chroma, sitting
between 500 and 400 at oklch(66% 0.046 257.4). Measured in Chrome that
is 6.5:1 on slate-950, 5.8:1 on slate-900 and 4.7:1 on slate-800. It is
only 3.3:1 on slate-700, which is fine because nothing muted lands
there: slate-700 backs buttons and hovered menu rows, which use
slate-200 or white. Keeping it that way is the one rule this token
depends on, so it is written down in index.css and asserted in the test.

Three failures only show up in a state a static scan of the default view
misses:

- The language dropdowns in SourcePane and EmbedTranslationPane inherit
  their header's slate-400. That passes on the slate-800 menu, then
  drops to 3.9:1 the moment hover paints slate-700 underneath. They now
  set slate-200 explicitly rather than inheriting.
- The collapsed MemDia labels sit at emerald-300/60, which is 4.9:1 on
  slate-900 but 4.4:1 once the row is hovered. /70 clears both.
- Blockly draws disabled menu items with a plain class rather than a
  real disabled control, so the "inactive component" exemption does not
  apply to them.

The disabled account-nav items are exempt — they are genuinely disabled
buttons — but at 2.36:1 they were unreadable rather than dimmed, so they
move to the token too.

tests/color-contrast.test.ts guards both halves the way text-size.test.ts
does: it bans the three too-dark classes outright, and recomputes the
token's ratio against each surface from the oklch values so lightening a
background cannot quietly push it under the floor.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Axe reports three structural failures alongside the contrast ones. A
screen-reader user landing on the editor or the embed player finds a
document with no heading at all, and on the embed and the signed-out
account card, content that sits outside any landmark — so "jump to main"
and "list headings", the two things people navigate a page with, both
come up empty.

The editor already has a <main> and a skip link; it only lacks a
heading, because the visible "Praxly" wordmark is a link home rather than
a title. An sr-only h1 supplies one. It goes inside <main> rather than
above it: that is both where the skip link lands and the only way the
heading is itself inside a landmark.

The account page has the landmarks but no h1 either, and there the fix is
free — "Praxly Account" in the header is already the page's title, so it
becomes the h1 with its styling untouched.

The embed player and its error screen, and the signed-out account card,
are each the whole page when they render, so their outermost div becomes
<main>. The embed player takes an sr-only h1; the error screen's h2 is
promoted, since a page whose only heading is an h2 was already skipping a
level. Its icon picks up aria-hidden — it repeats the message beside it.

With these and the contrast fixes, axe reports no violations across the
editor (default, translation panel, AI panel, settings and examples
menus, run output, source-language dropdown, blocks), the account page,
and the embed player including its error state.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Spelling was split between US and British across comments, docs, test
names and one user-facing string — "behaviour" in CLAUDE.md next to
"color" in the CSS, "normalise" in the Selenium harness next to
"normalize" nowhere else. Pick US and apply it: behaviour, colour, grey,
cancelled, labelled, normalise, tokenises, recognise(s), unrecognised,
initialising, uninitialised, parenthesise(ation) and memorising, 54
occurrences across 18 files.

Almost all of it is prose. The three that are not:

- `normalise()` in csv/selenium.test.ts, a file-local helper with four
  call sites, is renamed.
- The twelve `it('tokenises …')` titles in tests/javascript.test.ts are
  test names, so they read out in the runner.
- 'Google sign-in was cancelled.' is shown to the user.

blockDefs.ts and the assertion in blocks.test.ts that reads it keep
`colour` and `colourPrimary`: those are Blockly's own field names, and
spelling them any other way would stop working. A note in blockDefs.ts
says so, since it is now the only British spelling left in the repo.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The parse-tree panel is a debugging/curiosity view, not a translation
target, so it now sits with the AI Assistant below the divider instead of
leading the language rail.

"AST" also meant nothing to most teachers and students. LANG_LABELS.ast
is now "Parse Tree", the sidebar tooltip spells out "Parse Tree (AST)" so
the real term stays discoverable, and the panes that hard-coded "AST"
(translation pane header, embed chip and menu, source pane) read the
shared label instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The output panel had two inconsistent affordances: expanded, only a small
chevron button on the left closed it; collapsed, the whole bar reopened it
via a chevron on the right with no tooltip. Both buttons are gone — the
header bar itself is the toggle in either state, with matching hover,
focus ring, and Enter/Space handling, and aria-expanded carrying the state.

The state now rides along in praxly-editor-state as showOutput, next to
showAiChat and showMemDia, so a reload or revisit keeps the console as the
user left it. The field is optional: sessions saved before this open as
before.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Clear now goes through the same "this discards your code" modal as Demo
and Examples. Since CodeMirror's undo covers all three, they now say how
to get the code back instead of claiming the change is permanent.

The button itself is hidden behind a `false &&` guard for the moment;
the handler, state, and modal stay wired up so it can come back.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Demo/Examples/Settings lose the all-caps treatment, Settings and Share
swap places, Share picks up the same look as the other three (now a
shared `secondaryBtn` class), and the four sit 1px tighter than Debug
and Run. "Run Code" becomes just "Run".

Every button gets a title tooltip, and the hover states all move in the
same direction: Run, Step, and Stop were getting darker on hover while
everything else got lighter. Run also no longer lifts on hover.

The Selenium harness found the run button by its "Run Code" text, so it
now uses the aria-label, which is stable across label changes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The source-language picker, the console header (worded for whichever
way the click will toggle it), and each language view's close button
now say what they do on hover. The close tooltip reuses the label the
pane header shows, hoisted into `paneTitle` so the two can't drift.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ChrisMayfield
ChrisMayfield merged commit 67d4e52 into main Aug 15, 2026
1 check passed
@ChrisMayfield
ChrisMayfield deleted the ui-polish branch August 15, 2026 14:47
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