Conversation
CommandButton rendered active/disabled styling for every command but
never surfaced the underlying state to assistive tech: toggle-style
commands (Pan Mode, Pointer Mode) had no aria-pressed, and every
menu- or panel-opening command (Document Menu, Page Settings, Zoom
Menu, the tools overflow menus, sidebar panels, ...) had no
aria-expanded, so a screen reader announced a plain unstated button
for all of them.
Add activeAriaState to Command ('pressed' | 'expanded') so a command
declares which ARIA state its `active` value maps to, and have
CommandButton apply it. Pan Mode and Pointer Mode also drop the
"Toggle " prefix from their label now that the pressed state is
announced separately, matching how no other toggle in this toolbar
says "Toggle" in its name.
mode-select-button.tsx renders its trigger directly rather than
through CommandButton, so it gets the same aria-expanded fix inline.
Deliberately left out: the mode:view/annotate/shapes/insert/form
commands, whose `active` represents which mutually-exclusive editing
mode is selected rather than a pressed or expanded state — that shape
fits a tablist/radiogroup pattern, which is a bigger, separate change.
|
@etuan is attempting to deploy a commit to the CloudPDF Team on Vercel. A member of the Team first needs to authorize it. |
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
CommandButtonrendersactive/disabledstyling for every command, but never surfaced that state to assistive tech:aria-pressed, so a screen reader announced them as a plain, stateless button — you couldn't tell whether pan mode was currently on.aria-expanded.Additionally, "Toggle Pan Mode" / "Toggle Pointer Mode" is an odd accessible name for a button whose pressed state is (now) announced separately — no other toggle in this toolbar says "Toggle" in its name.
Fix
@embedpdf/plugin-commands: addactiveAriaState?: 'pressed' | 'expanded'toCommand, resolved ontoResolvedCommandincommands-plugin.ts.@embedpdf/snippet:CommandButtonmapsactiveAriaStateto the matching ARIA prop (aria-pressedfor'pressed',aria-expandedfor'expanded') and spreads it ontoButton.commands.ts: markpan:toggle/pointer:toggleas'pressed', and everytoggleMenu(...)/toggleSidebar(...)-backed command as'expanded'(21 commands total — see diff).translations.ts:pan.toggle/pointer.togglelabels changed from "Toggle Pan Mode"/"Toggle Pointer Mode" to "Pan Mode"/"Pointer Mode".mode-select-button.tsxrenders its trigger directly rather than throughCommandButton, so it gets the samearia-expandedfix applied inline.Deliberately out of scope
mode:view/mode:annotate/mode:shapes/mode:insert/mode:formare excluded. Theiractiverepresents which mutually-exclusive editing mode is currently selected, not a pressed or expanded state — that's a tabs/radiogroup shape (aria-selected/aria-checkedon arole="tablist"/role="radiogroup"structure), which is a bigger, separate change I didn't want to fold into this one.Steps to reproduce (before this fix)
WCAG 4.1.2 (Name, Role, Value).
Changesets
Two changeset files included, one per affected package, per
.agents/skills/embedpdf-changesets.Testing
Manually verified per the repro steps above; no existing test suite for this package.