Repository navigation
Conversation
… forced colors - A Close button (labels.close) in the input row on touch screens, in the esc hint's place, 44 by 44 px. A phone has no Escape key, and with an answer showing the dialog left an 8 px strip of page to tap. - Focus moves on when the pressed control goes away: a thumb to "Add a comment", a sent comment to "New question", and Stop or Retry pressed from the keyboard to the input. It fell to the dialog's container. - Each source's name starts with its number and whether the answer cites it (labels.source, sourceCited, sourceNotCited); the URL is aria-hidden, and cited sources have their number filled. - An error is announced once, by its alert, not again by the status. - The combobox is expanded only while its list shows, and named once, by the dialog's title; the key glyphs are aria-hidden; thread questions and Sources are h3 headings. - Numbered steps split by code or a blank line keep their numbers. - Touch screens get 44 px buttons and a 26 px tap area on citations; forced colors outline the selected suggestion, fill the cited sources' numbers and border the navbar button.
…ng; Next budget - Enter on the Close button closes the dialog. The command palette around it took Enter: with a suggestion selected it asked that suggestion, and with an answer showing it did nothing. Close keeps its own keys, as Stop does. - After a thumb, focus moves on to "Add a comment" only if it was lost. A visitor who moved focus while the rating was sent kept being pulled back when the response landed. - On touch screens, only a citation right after another ([1][2], [1, 2]) gets extra room: 12 px, twice the 6 px reach of each tap area, so the two areas no longer meet. Next to words and punctuation a citation keeps its usual 0.12em margin, without the 5.4 px gap before a full stop. - js-weight: the Next.js site inlines ondocs/react/styles.css in its page payload, so the new dialog styles count before interaction there: 180.5 KB, over the 180 KB budget. Raised to 182, and the open figures updated.
This branch has not been deployed
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.
Roadmap item od-a11y: OD2-19, OD2-20 and OD2-58 in one PR, as they all edit
dialog-panel.tsx,labels.tsandstyles.css.What was wrong
Measured on main with Playwright's Chromium against the script-tag embed and the mock endpoint:
document.activeElementonDIV.ask-dialog, because the control unmounted. A screen reader reads the dialog out again and the keyboard loses its place.Docusaurus Install it /docs/docusaurus#install-it: no number to match a citation ("Source 2: …"), no cited state, and the raw URL.<ol>s with nostart..ondocs-buttonhad0px noneborder. On touch screens the thumbs were 34×28, the other buttons 28 px tall, and a citation chip's tap area was 16×15.5 px, 2.6 px from its neighbour. ARIA nits: the combobox stayedaria-expanded="true"while the answer showed, the ↵ and esc glyphs were in names and text, the title was read twice (cmdk's hidden label repeats it), and thread questions were paragraphs.What changed
Dialog.Closein the input row, named by a newcloselabel ("Close"). It shows under(hover: none)in the esc hint's place, 44×44 px, with its icon lined up with the search icon. Desktop is unchanged. Like Stop, it keeps Enter from cmdk's<Command>, which otherwise cancels Enter and selects the highlighted item: a phone or tablet with a hardware keyboard would ask the selected suggestion, or do nothing with an answer showing, instead of closing.document.activeElement === document.body): a visitor who tabbed elsewhere while the rating was sent stays there. Stop and Retry move it to the input when pressed from the keyboard or a screen reader (event.detail === 0). I did not do that for a tap: focusing the input from a tap would bring up the phone's keyboard over the answer. A test locks this in.source("Source {n}:", while the answer streams),sourceCited("Source {n}, cited:") andsourceNotCited("Source {n}, not cited:"). The URL span isaria-hidden. Cited sources have their number filled (accent-fg on accent: 5.36:1 light, 10.62:1 dark), so they differ by more than a shade. I kept one list rather than splitting it into "Cited" and "Also searched", which would have changed the layout and the order.statusMessagereturns nothing for an error; the alert says it. Retry stays inside the alert, astest/misconfigured-dialog.test.tsxexpects.<ol start>takes the first item's number, so split steps read 1, 2, 3 and a list the model starts at 3 starts at 3.aria-expandedto true and its ownaria-labelledbyafter spreading the caller's props, so both are set on the input from a ref once cmdk has rendered: expanded only while the list has something to pick, and labelled by the dialog's own title. cmdk's label is left empty, so the title is no longer read twice. I triedaria-labelwith an empty cmdk label first;dom-accessibility-api(what Testing Library uses) gave the input no name, so screen readers may not fall back either. The ↵ and esc<kbd>s arearia-hidden. Thread questions and the Sources heading areh3under the dialog'sh2title, styled as before (font: inherit, so host heading styles don't leak in).(pointer: coarse), Stop, Retry, New question, the thumbs, Send and the comment field are 44 px tall. Each citation gets a transparent::afterwithinset: -6px. A citation right after another ([1][2],[1, 2], or with only a space between) is markeddata-after-citationwhen it renders, and getsmargin-left: 12px, twice the inset, so the two tap areas do not meet. Elsewhere a citation keeps its usual0.12emmargins, so there is no gap before a full stop. A CSS.ask-citation + .ask-citationrule could not do this: it also matches[1] some words [2], because sibling selectors skip text.outline: 2px solid Highlight, cited badges getHighlight/HighlightTextwithforced-color-adjust: none, and.ondocs-buttongetsborder: 1px solid ButtonText, insrc/embed/button.cssandsrc/docusaurus/launcher.css.scripts/js-weight.mjs, outside the od-a11y file list). The site inlinesondocs/react/styles.cssinto its page's RSC payload, whichjs-weightcounts as JavaScript before interaction, so every new rule counts there. With the new styles the page measures 180.5 KB locally, over the 180 KB budget. The budget is now 182 KB, with a comment saying why, and theopenfigures are updated to this branch's measurements.pnpm build && pnpm examples:sync). The changeset is a patch forondocs.How it was tested
Run against main's source, the three test files fail 17 tests: the 16 new ones below other than the guard, and the one updated assertion (on main the question is a paragraph). The guard passes on both.
test/keyboard-dialog.test.tsx: focus after a thumb, a sent comment, Stop and Retry (Enter); a tap on Stop leaves the input unfocused (the guard, which passes on main too); focus stays on "New question" when the visitor moves it there while the rating is sent; the Close button closes the dialog with an answer showing, closes on Enter both with a suggestion selected (and asks nothing) and with an answer showing, and takeslabels.close.test/react.test.tsx: steps split by code or blank lines start at 1, 2, 3, and a list can start at 3; an error leaves the status empty; source names carry the number and cited state, and the URL isaria-hidden; the combobox is named once by the title, collapsed while the answer shows and expanded again for a follow-up; glyphs arearia-hidden; thread questions and Sources are level-3 headings; a citation right after another is markeddata-after-citation, and one after words is not. One existing assertion now finds the question over an error by its heading role instead ofselector: 'p'.test/touch-and-forced-colors.test.ts(new): the Close and esc rules under(hover: none), the 44 px and citation rules under(pointer: coarse)(no margin on every citation, and a follower's margin at least twice the tap area's inset), the forced-colors rules, and the navbar button border in both stylesheets.The review fixes add four tests and change one (the coarse-pointer rules). Against the branch's first commit, all five fail; with the fixes they pass.
Gate, all passing:
pnpm install --frozen-lockfile --prefer-offline,pnpm format:check,pnpm lint,pnpm typecheck,pnpm test(95 files passed, 1 skipped; 1304 tests passed, 10 skipped),pnpm build,pnpm examples:check(32 pages), andpnpm validate(exit 0, with the four example builds).The JavaScript budgets, run locally after those builds:
node scripts/js-weight.mjs docusaurus starlight vitepress next embed --checkpasses:The first version of this description said the change only touched the lazy dialog chunk. That was wrong for the Next.js site: its HTML has the dialog's styles in a
<style>tag and again in theself.__next_f.pushpayload script, and the script copy counts before interaction. On the other sites the new code and styles do load only with the dialog.node scripts/embed-size.mjspasses (embed-dialog.global.js98.5 KB gzipped, budget 110;embed.global.js3.2 KB), andnode scripts/mobile-width.mjspasses (35 pages at 390 px, none scrolls sideways). Withgzip -9,embed-dialog.global.jsis 100,768 bytes andembed.global.jsis 3,329. I ran both browser scripts on ports 4100 to 4999 rather than their built-in ports.Browser check (Playwright Chromium, the script-tag embed built from main and from this branch, mock endpoint). The results were the same in light and dark:
ol.start)DIV.ask-dialogDIV.ask-dialogaria-expandedwith the answer showingDocusaurus Install it /docs/docusaurus#install-itSource 2, cited: Docusaurus Install itClosing and reopening the dialog with an answer kept leaves the input named by the title and collapsed.
The review fixes, checked the same way (Playwright Chromium, the script-tag embed with
data-suggestions, a real handler with a scripted answer containing[1][2]and[1, 2], and anonFeedbackthat takes 1.5 s). The two columns are this branch's first commit and the branch now:Not in this PR
role="alert", so the one announcement ends with "Retry" ("Something went wrong (500). Please try again.Retry"). Moving it out of the alert means changingtest/misconfigured-dialog.test.tsxtoo, which is outside this bundle, so it is a follow-up.aria-expandedon the plugins' navbar buttons is insrc/starlight/Search.astroandsrc/docusaurus/theme/Navbar/Search.tsx, outside this bundle's files.footerCloselabel unused.McpInstall's<pre>not reachable by keyboard (its Astro twin is outside these files);