Skip to content

Add Dyslexic font option to Accessibility settings#70

Merged
nschneble merged 14 commits into
mainfrom
feature/dyslexic-font-accessibility
Jul 24, 2026
Merged

Add Dyslexic font option to Accessibility settings#70
nschneble merged 14 commits into
mainfrom
feature/dyslexic-font-accessibility

Conversation

@nschneble

@nschneble nschneble commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Adds a Dyslexic font option to Accessibility settings, letting users render the interface in a dyslexia-friendly typeface.

Add a `dyslexicFont` Boolean preference to the User model, mirroring the
existing `cvdMode` field's plumbing: schema column with `@default(false)`,
squawk-clean migration, `UpdateMeDto` validation, and `UsersService.updateMe`
handling. Wave 1 of 5 for the Dyslexic font accessibility option; front-end
wiring follows in later waves.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@nschneble nschneble self-assigned this Jul 23, 2026
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

👁️ Tuffgal visual regression

Outcome: pass

Status Count
Pass 35
Changed 0
New 0
Deleted 0
Failed 0
Total 35

View the run →

nschneble and others added 3 commits July 23, 2026 13:07
Vendor self-hosted OpenDyslexic faces and add the [data-dyslexic-font='on']
override behind the (not-yet-wired) Accessibility toggle.

- Sans (Regular + Bold woff2, SIL OFL 1.1) drives --font-sans and Preflight's
  --default-font-family; Mono (Regular otf, CC BY 3.0 + Bitstream Vera) drives
  --font-mono. Mono ships no Bold face, so the browser synthesizes bold.
- Override the font custom properties (not font-family on a selector) in an
  unlayered block mirroring [data-cvd='on'], so every .font-sans/.font-mono
  utility and the body default resolve to OpenDyslexic at runtime. Font Awesome
  and .app-mock-asemic set font-family on themselves and are unaffected.
- Add letter/word/line spacing below the WCAG 1.4.12 reference ceiling with no
  !important, so a user's own text-spacing override still wins.
- Families are referenced only inside the scoped block, so the files are never
  fetched while the toggle is off (verified against compiled dist CSS).
- Commit both license files and correct the stale "only @font-face" comment.

Toggle wiring (ThemeContext, UI) lands in later waves.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Wave 3 of the Dyslexic font accessibility option. Connects wave 1's
persisted `dyslexicFont` user field to wave 2's `[data-dyslexic-font='on']`
CSS block by mirroring the existing CVD state plumbing:

- storage.ts: `DYSLEXIC_FONT_KEY` + `DYSLEXIC_FONT_UPDATED_AT_KEY`
- useThemeState: `isDyslexicFont` state, layout effect toggling
  `data-dyslexic-font` on `<html>`, and `enableDyslexicFont`/
  `disableDyslexicFont` actions (pure attribute toggle, no theme coupling,
  so they return void unlike the CVD actions)
- ThemeContext + AuthContext types, MeResponse, and mapMeToUser mapping
- App.tsx: server-sync effect with the same 30s local-change race guard

No UI control and no server PATCH yet (wave 4); no Tuffgal stories (wave 5).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds a DyslexicFontToggle to the Accessibility settings section, wired
between the CVD-mode and keyboard-shortcuts toggles. It reads and flips
the OpenDyslexic override exposed on ThemeContext (wave 3), optimistically
toggling then persisting via PATCH /users/me with { dyslexicFont }, and
reverts the local flip if the request fails.

The font preference is independent of the color theme, so no theme field
rides along with the request (unlike CVD mode). Copy avoids efficacy verbs
per the pre-build accessibility gate; the switch mirrors CvdModeToggle's
role="switch" / aria wiring 1:1 with dyslexic-font-* ids.

Also adds dyslexicFont to updateMe's input type and a DyslexicFontToggle
mock to SettingsView's test.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
github-actions Bot pushed a commit that referenced this pull request Jul 23, 2026
Address crew-pass warnings on the dyslexic-font feature (no blockers):

- Extract shared SettingSwitch from the three role="switch" toggles (CVD,
  dyslexic font, keyboard shortcuts); each caller keeps its own state and
  persistence and renders the shared markup. Standardize the knob on w-4 h-4.
- Extract useServerBooleanPrefSync so App's CVD and dyslexic-font syncs share
  one guarded hook; brings App.tsx back under 100 lines.
- Register SettingSwitch.tsx in the chrome-token MIGRATED_FILES allowlist so the
  extracted chrome tokens stay tripwire-protected.
- Reword the dyslexic-font description for parallel grammar (mechanism only).
- Recast feature-introduced em-dashes in comments to commas, colons, or parens.
- Add the data-dyslexic-font hook mention to apps/web/README.md.
- Add dyslexicFont to seven mock user factories.

Behavior-neutral: rendered DOM and ARIA for all three toggles are unchanged;
the existing toggle tests pass with no assertion changes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
github-actions Bot pushed a commit that referenced this pull request Jul 23, 2026
Mirror the CVD-mode story/action shape for DyslexicFontToggle. The action
navigates to /settings, clicks the "OpenDyslexic font" switch, then proves the
swap two ways: a read step asserts the html[data-dyslexic-font="on"] attribute
that index.css keys off (the actual font-swap mechanism, not just the toggle
UI), and a scoped expect on the aria-labelledby switch confirms aria-checked
flips. Scoping avoids a false pass against the always-on keyboard-shortcuts
switch. Tuffgal has no computed-style primitive, so the DOM attribute is the
strongest available proof the font truly engages.

Move DyslexicFontToggle's rendered-state coverage to the story layer, dropping
the three pure-render unit tests (unchecked/checked/aria ids) now that the
story owns them, matching CvdModeToggle which has no unit test. The persist
tests stay: they assert the PATCH payload carries dyslexicFont alone with no
theme field, a contract a story cannot observe.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
github-actions Bot pushed a commit that referenced this pull request Jul 23, 2026
…lectors

Reformat the [data-dyslexic-font='on'] multi-value custom properties
into Prettier's canonical multi-line form. npm run format never touches
this file (its glob excludes .css), so npx prettier --write was run
directly. Whitespace-only; built CSS values are byte-identical.

Swap escaped double-quotes for single quotes in the toggle-dyslexic-font
Tuffgal action selectors to match the sibling-action house style. CSS
attribute selectors are quote-agnostic, so matching is unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
github-actions Bot pushed a commit that referenced this pull request Jul 23, 2026
@nschneble
nschneble marked this pull request as ready for review July 24, 2026 00:42
github-actions Bot pushed a commit that referenced this pull request Jul 24, 2026
github-actions Bot pushed a commit that referenced this pull request Jul 24, 2026
github-actions Bot pushed a commit that referenced this pull request Jul 24, 2026
github-actions Bot pushed a commit that referenced this pull request Jul 24, 2026
@github-actions

Copy link
Copy Markdown

🚀 Committed candidate baselines to feature/dyslexic-font-accessibility as 15da8c6.

⚠️ The visual regression check will not re-run on its own — GitHub does not trigger workflows for commits pushed with GITHUB_TOKEN. Kick it with any of:

  • close and reopen this PR,
  • push an empty commit (git commit --allow-empty -m "retrigger" && git push), or
  • re-run the visual workflow from the Actions tab.

To make the check clear itself automatically, pass a PAT / GitHub App token via the token input (see the README trade-off).

@nschneble
nschneble merged commit b9f8e58 into main Jul 24, 2026
4 checks passed
@nschneble
nschneble deleted the feature/dyslexic-font-accessibility branch July 24, 2026 03:03
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