Repository navigation
fix(a11y): name diagrams and the table of contents in the page language - #58
Merged
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
The UI table held 'Flowchart: ' with its colon and trailing space, so the label text and the punctuation could not change on their own. Store the name, the colon and the list separator as separate entries, and build the label in one helper, diagramLabel(), used by flow and sequence. The English fallback for a component rendered without a page context now lives in that helper only. Add a test for the fallback.
Owner
|
Thanks @kevin9327, this is a clean fix for #47. Moving the labels into the I pushed one commit on top of your branch (
I merged the latest Merged with a squash, so |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #47.
On English and Japanese pages, screen readers announced three accessible names in Chinese: flow diagrams (
流程图:…), sequence diagrams (时序图:…), and the doc template's table of contents (目录).src/render.js: theUIlabel table getstoc,flow,sequenceand a list separatorsepfor zh / en / ja. The page language is now worked out before the panels are rendered. The UI strings go to components through the render context and to templates asui.Contents,Flowchart: A, B,Sequence diagram: A, B目次,フローチャート:A、B,シーケンス図:A、Bsrc/components/flow.jsandsrc/components/sequence.js: thearia-labelusesui.flow/ui.sequenceand joins names withui.sep. When a component is rendered without a context, as in the component unit tests, it falls back to English. Thelang-okmarkers for Page aria-labels are always Chinese (flow, sequence, doc table of contents) #47 are gone.src/templates/doc.js: the TOCaria-labelusesui.toc.src/video/render.js: video scenes pass the same page labels, so a diagram in a video draft is named in the draft's language too.test/render.test.js: the new test renders an en, a zh and a ja doc draft with a flow, a sequence and 3 panels. It checks all three labels for each language. It fails on main.Verification
npm testpasses (287 pass, 3 skipped, 0 fail)npm run buildand committed the rebuiltam.mjsnpm run snapshot: 120 of 336 combinations differ fromorigin/main, all intended. Every difference is in the en example drafts (tcp.en.md,ste100.md). I rendered each example with both versions and diffed the output: onlyaria-labelvalues change, from目录→Contents,时序图:Client、Server→Sequence diagram: Client, Server, and流程图:CLOSED、LISTEN、…→Flowchart: CLOSED, LISTEN, …. The zh examples (tcp.md,architecture.md) render identically.