Repository navigation
fix(app-shell): name the copy buttons in an action's result dialog and announce the copied state - #28265
Merged
Conversation
…e copied state Each icon-only copy button carries an accessible name built from its field's label (or its position in a code list), from new actions.resultDialog keys in all ten packs. A polite live region, mounted empty, announces the copied state. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvSA9x5ZD2RncR2GRx
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvSA9x5ZD2RncR2GRx
Contributor
Author
|
domain:ui#1 · os-tesla · session_01L9qibzC6RxMfB59EsgAoNN 席位核对ACCEPT · seat 席位意见:动作结果对话框(邀请链接、新 API 密钥、2FA 密钥等只显示一次的值)里,每个只有图标的复制按钮现在都有可读的名称,例如「复制 Email」。代码列表中的每一项按位置命名,复制成功后会礼貌地播报「已复制到剪贴板」。读屏和语音控制用户可以按名称找到并使用这些按钮。
|
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.
Requested by Tesla · project thread
Fixes #28186
Clause-②: no
Metadata-protocol: none
维护者速读
ui/packages/app-shell/src/views/ActionResultDialog.tsx(CopyButton与ResultField里的copyName);ui/packages/app-shell/src/views/__tests__/ActionResultDialog.test.tsx新增的 describe;ui/packages/i18n/src/locales/en.ts的actions.resultDialog。pnpm --dir ui exec vitest run packages/app-shell/src/views/__tests__/ActionResultDialog.test.tsx,预期 1 个文件、12 个测试全绿。What changes
Names (
ui/packages/app-shell/src/views/ActionResultDialog.tsx).ResultFieldalready resolves the field'sI18nLabel; it now builds the accessible name of that field's copy buttons from it and hands it to the format block (QrcodeBlock,SecretBlock,TextBlock,JsonBlock,CodeListBlock):actions.resultDialog.copyField("Copy LABEL");actions.resultDialog.copyValue("Copy value");copyFieldItem("Copy LABEL, item N") orcopyItem("Copy item N").CopyButtontakes either a visiblelabel(that text is its name, as "Copy all" already was) or anamethat becomes itsaria-label; the prop type makes one of the two required, so a new icon-only use cannot compile without a name. TheCopy/Checkicons are markedaria-hidden.Copied state. Each
CopyButtonrenders a visually hiddenrole="status"region (implicitly polite) beside the button. It is mounted empty and filled withactions.resultDialog.copied("Copied to clipboard") while the copied state lasts, so a screen reader announces the change. It is positioned out of flow bysr-only, so the flex rows keep their layout.Translations. The five keys are added under
actions.resultDialogin all ten packs (en,zh,ja,ko,de,fr,es,pt,ru,ar), next to the existingcopyAll.#27521's focus pins. The change does not touch
useActionDialogReturnFocusor the dialog's focus props;actionDialogFocus-27521.test.tsxis run below as a control.Tests
ui/packages/app-shell/src/views/__tests__/ActionResultDialog.test.tsxgains a describe, "every copy button has an accessible name", with role-and-name queries. The file'suseObjectTranslationstub now echoes interpolation params after the key, so a name shows which label reached it (existing assertions use no params and are unchanged).getByRole('button', { name: 'actions.resultDialog.copyField(label=LABEL)' });copyValue;copyFieldItemwith index 1 and 2, and "Copy all" keeps its visible name; an unlabelled list's are namedcopyItem;statusregion exists and is empty before the click,writeTextreceives the value, and the same region node then readsactions.resultDialog.copied.Acceptance notes
resultDialogdeclares two code lists, so this is noted, not changed.Verification
Tree: objectstack-ai/objectstack, branch head named in the os-dev report on the card.
Result dialog tests
Ablation: the fix removed, the new pins go red
aria-labelonCopyButtonand thestatusspan deleted (0 hits for each confirmed on disk), same command:Restored with
git checkout HEAD --;git diff HEADempty afterwards. The 6 pre-existing tests stayed green in both legs.Derived gates (dispatch-gates --commands, head f68fcad): 34 of 34 exit 0, reconciliation 34 run, 0 NOT-MEASURED, 0 UNRUN
check:type-check-debtfirst hit a 500 stimeoutwrapper while the type-check below held the box (exit 124); re-run alone, exit 0, and the record carries that code.Type-check, sibling tests and line citations
Generated by Claude Code