Repository navigation
Commit 8a8a03d
fix(studio): a refusal in a Studio strip is announced to screen readers (#29224)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbPQhqXLEJrxrqzKQ49MhRNU)_
Fixes #29139
Clause-②: no
Metadata-protocol: none
The two lines are copied from the claim (comment 6572863221).
## 维护者速读
- 改了什么:Studio 所有支柱共用的拒绝条(`StudioRefusalStrip`)里,那句拒绝说明现在是
`role="alert"`,读屏软件会在它出现时立即朗读,朗读内容就是服务器原话;"Show me" 按钮和 Details 展开区留在
alert 之外。视觉上没有任何变化。
- 为什么改:Setup 的 Packaged automation 页退役、开关搬进 Studio
后,开关被拒(409/403)只显示在这条没有 role、没有 live region
的拒绝条里,使用读屏的管理员拨开关时什么也听不到,开关只是不动。退役前的 Setup 页用一个带 `role="alert"`
的段落播报同一句话(18.3.0 RC 清单项 automation.setup-packaged-automation-board 的
acceptance[5])。
- 风险与回滚:只加一个 ARIA
属性,影响所有用这条拒绝条的地方(Interfaces、Data、Automations、发布清单的行);不改文案、不改布局、不改数据。回滚即撤销本
PR。
- 先看:`StudioDesignSurface.tsx` 中 `StudioRefusalStrip` 的
`studio-refusal-message` 那一行;新测试
`StudioDesignSurface.refusalAnnounced-29139.test.tsx`;`AutomationsPillar.ledgerSwitch-28148.test.tsx`
新增的 409 用例。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/app-shell/src/views/studio-design/StudioDesignSurface.refusalAnnounced-29139.test.tsx
packages/app-shell/src/views/studio-design/AutomationsPillar.ledgerSwitch-28148.test.tsx`,预期
12 个用例全部通过。
- 需要你做的:无,席位落地。
## What changes
- `StudioRefusalStrip`
(`ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx`,
the strip block only): the sentence element,
`data-testid="studio-refusal-message"`, carries `role="alert"`. Nothing
else in the strip moves: no new string, no new prop, no layout change.
- Every pillar that draws the strip gets it from the one component: the
Interfaces leaf and nav strips, the Data object strip, the Automations
flow strip (where the ledger switch's 409 and 403 land), and the publish
sheet's per-row refusal.
## Why this role, on this element
- **`role="alert"`, not a polite region.** The strip is mounted with its
sentence already in it (every call site renders it only when there is a
refusal). An alert is announced when it is inserted; a polite live
region inserted already filled is not reliably announced, because a live
region must exist before its content changes. And what it shows is a
refusal that stopped what the author just did, which is what an
assertive alert is for.
- **On the sentence, not on the strip.** The retired Setup › Packaged
automation page rendered the refusal as a paragraph with `role="alert"`
holding the server's sentence verbatim, beside the switch, and the
checklist item `automation.setup-packaged-automation-board`
acceptance[5] scores exactly that: the alert's text equals the server
sentence. With the role on the whole strip, the alert would also read
"Show me" and "Details", and opening the Details disclosure would change
the alert's content and announce it again. On the sentence alone, the
announcement is the sentence, and the strip's two controls stay
ordinary, reachable controls after it.
- A second refusal of the same flip is announced again: the Automations
pillar clears its error before each toggle request, so the strip leaves
while the request is in flight and the alert that comes back is a new
element.
## Tests
- New `StudioDesignSurface.refusalAnnounced-29139.test.tsx` (the strip
itself, so every pillar is covered):
- a one-line and a multi-line refusal are each exactly one alert, inside
the strip, whose text is the sentence verbatim;
- with a target, an input and a detail, "Show me" and the Details
disclosure are outside the alert, before and after Details opens, and
"Show me" still calls `onShow` with the target and input.
- `AutomationsPillar.ledgerSwitch-28148.test.tsx`, one new case on the
card's reproduction (the ledger switch, the subflow guard's 409
`DELETE_RESTRICTED` naming the caller): no alert before the flip; after
it, one alert inside `studio-refusal` whose text is the 409 sentence
verbatim; flipped again with the same refusal, no alert while the
request is in flight (the toggle door is held on a gate), then a new
alert element with the same sentence; the switch still reads the ledger.
- Ablation, one leg: `role="alert"` dropped from the sentence through
`scripts/ablation-replace.mjs` (anchor 1 to 0, blob changed, restore
proven equal to HEAD with an empty `git diff HEAD`): 4 of the 12 cases
in the two files went red (the three strip pins and the 409 case), the 8
others stayed green.
- Neighbours: the 24 test files that render or query the strip, or query
an alert in Studio, 125/125 green.
- Live in a real browser, before and after: see Verification.
## Acceptance notes
- **`aria-describedby` from the switch to the sentence: not added; not a
local change.** The ledger switch (`FlowLedgerSwitch`) takes its
description ids from its own hint, the not-running reason and the walled
reason. The strip is drawn in the pillar body from the pillar's shared
`error` state, which load, save, delete and toggle failures all set, and
it has no id. Pointing the switch at the sentence needs an id on the
strip, a new prop on `FlowLedgerSwitch`, and the pillar telling a toggle
refusal apart from its other failures: three places outside the strip
block. Measured live, the switch's `aria-describedby` names one id (its
hint) before and after the refusal, on both legs. With the alert, the
sentence is announced when it lands; the link would let a reader hear it
again from the switch. Reported to the seat as a finding.
- **Focus leaves the ledger switch on every flip (pre-existing, measured
on both legs).** With the switch focused, Space flips it; while the
request is in flight the switch is `disabled` (busy), and after the
answer `document.activeElement` read `body`, on origin/main's strip and
on this branch alike. Most likely the disabled state drops the focus,
and nothing puts it back. A keyboard or screen-reader author has to find
the switch again after each flip. It is in `FlowLedgerSwitch.tsx`,
outside this card's file surface; reported to the seat as a finding.
## Verification
- **Live, the card's reproduction** (head 3d6fa84): a fresh showcase
(`objectstack dev --seed-admin --fresh` on a private port) with the
Console served from source by Vite, signed in as the seeded admin,
Studio › Automations › `showcase_notify_owner` (a read-only package, so
the ledger switch), flipped with Space from the keyboard, twice. The
real door answered both flips `409` `DELETE_RESTRICTED`, naming the
caller `showcase_task_done_notify_owner`.
- This branch: before the flip, no alert on the page. After it, one
`role="alert"` inside `studio-refusal`, its text the response's
`error.message` byte for byte, and Playwright's aria snapshot of the
strip reads `- alert: "Flow 'showcase_notify_owner' cannot be disabled
while 1 packaged flow still calls it as a subflow: ..."`. A DOM observer
counted two alert insertions over the two refusals, each with the
sentence.
- origin/main's strip (its file swapped in under Vite, then restored,
blob and empty `git diff HEAD` proven): the same sentence is a `-
paragraph`, no alert on the page, no insertion over two refusals.
- The strip's screenshot is byte-identical on the two legs (same md5):
nothing visual moved.
- **Gates:** `node scripts/pm/dispatch-gates.mjs --commands` derived 34
commands for this diff; all 34 ran at 5c8cc56 (the fix commit; the two
later commits merge main and leave the delta to main at these four
files), each exit 0, including `node scripts/check-sdui-manifest.mjs`
and `pnpm --dir ui exec vitest run scripts/` (169 files, 4900 tests).
`--ran` reconciliation: 34 derived, 34 run, 0 NOT-MEASURED.
- **Tests:** the two touched files 12/12 and the 24 neighbour files
125/125 at 5c8cc56 and again at 3d6fa84. The second merge of main
(0dffec2) brings four commits, none under `ui/packages/app-shell`; CI's
Test UI runs the head.
- **Type-check:** `turbo run type-check --filter=@object-ui/app-shell`
(both `tsc --noEmit` and `tsc -p tsconfig.test.json`) green at 5c8cc56
and at 3d6fa84.
- **Lint:** eslint on the three touched ui files, 0 errors; its 43
warnings are all on existing lines of `StudioDesignSurface.tsx`, none in
the strip block or the tests. The repo-wide run is CI's Lint UI.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes. (Measured on the touched
files only; see Verification.)
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed. (Not touched.)
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01QsR2jReFyNpMGkARoUHPD3
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jReFyNpMGkARoUHPD3)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent c84f795 commit 8a8a03d
4 files changed
Lines changed: 136 additions & 2 deletions
File tree
- .changeset
- ui/packages/app-shell/src/views/studio-design
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
| 115 | + | |
| 116 | + | |
114 | 117 | | |
115 | 118 | | |
116 | 119 | | |
| |||
123 | 126 | | |
124 | 127 | | |
125 | 128 | | |
| 129 | + | |
126 | 130 | | |
127 | 131 | | |
128 | 132 | | |
| |||
140 | 144 | | |
141 | 145 | | |
142 | 146 | | |
| 147 | + | |
143 | 148 | | |
144 | 149 | | |
145 | 150 | | |
| |||
242 | 247 | | |
243 | 248 | | |
244 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
245 | 286 | | |
246 | 287 | | |
247 | 288 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
703 | 703 | | |
704 | 704 | | |
705 | 705 | | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
706 | 713 | | |
707 | 714 | | |
708 | 715 | | |
| |||
729 | 736 | | |
730 | 737 | | |
731 | 738 | | |
732 | | - | |
| 739 | + | |
733 | 740 | | |
734 | 741 | | |
735 | 742 | | |
| |||
0 commit comments