Repository navigation
fix(app-shell): name the page block inspector's JSON editor by its label - #27254
Merged
Merged
Conversation
InspectorJsonField drew its Label beside the textarea with no for/id pairing, so every curated JSON prop exposed an unnamed text box. Mint the id with React.useId() and pair Label htmlFor with the textarea id. Claude-Session: https://claude.ai/code/session_01JQwxbW6EicqdfE9onssvrp Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbW6EicqdfE9onssvrp Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
席位核对ACCEPT · seat 席位意见:Studio 页面块检查器里的 JSON 编辑框原先没有可访问名称:标签和文本框没有关联,屏幕阅读器读到的是一个无名文本框。现在用
|
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 Warren · project thread
Fixes #27178
Clause-②: no
Metadata-protocol: none
维护者速读
InspectorJsonField)的标签现在用htmlFor指向它的 textarea(id 由React.useId()生成)。PageBlockInspector.tsx中的InspectorJsonField;新测试PageBlockInspector.jsonFieldLabel-27178.test.tsx。pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/inspectors/PageBlockInspector.jsonFieldLabel-27178.test.tsx,预期 2/2 通过。What changes
InspectorJsonFieldinPageBlockInspector.tsxmints an id withReact.useId()and pairs it:Label htmlFor={id}and the textarea'sid={id}. This is the same schemeFilterRulesFieldandColorPropFieldin the same file already use. The id is minted inside the component, not derived from the label or prop name, becauserenderFieldalso draws this editor inside array rows, where a caller-derived id would repeat.Every door that draws the editor gets the pairing, because they all go through the one component: a curated
kind: 'json'prop (for examplerecord:related_list.add,element:button.action), the JSON fallback for a stored value in another union arm (sortstored as a string,columnsasListColumnobjects), and the generic "Advanced" editor for object or array props. There was noaria-describedbyor error wiring on the field to keep; the invalid-JSON message is unchanged.Tests
New
PageBlockInspector.jsonFieldLabel-27178.test.tsx, on the real inspector inside a host that applies every patch:getByLabelText('Add existing records (picker)')returns theaddtextarea, its accessible name is that label, and typing JSON and blurring writesaddin the stored shape.sort: 'subject'stored,getByLabelText('Sort')returns the JSON fallback textarea showing"subject", and theSortandaddeditors resolve to two different textareas with two different ids.At
bc69c4ad: everyPageBlockInspector*test file in the directory, 13 files, 86 tests passed.pnpm --filter @object-ui/app-shell run type-check(both the source and the test tsconfig): exit 0.eslinton the two changed files: exit 0, no new warning.Ablation (drop the htmlFor / id pair)
Through
scripts/ablation-replace.mjs, on the committed fix: anchor hits 1 to 0, blobe552a33eto1da05b77. Both new tests turn red with the card's own wording:Found a label with the text of: Add existing records (picker), however no form control was found associated to that labeland the same forSort. Restore: blob back to the HEAD blobe552a33e,git diff HEADempty.Acceptance notes
@object-ui/app-shellisprivate: true, so the PR carriesskip-changeset.jsonEditorUnderhelper inPageBlockInspector.relatedListProps-27054.test.tsxsays the label "is a sibling, not afor". That comment is now out of date; the helper still works because the label and the textarea share a parent. Left as is (outside this card's file surface).FieldListField's label, and thestring-listandarraylabels inrenderField. Each labels a group of rows, so the fix there is a group name (role="group"witharia-labelledby), not thisforpairing. Reported to the seat as a finding; not changed here.Verification
Derived gates at
e781cf8f(node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack, 24 families), every one run locally, exit codes captured before any pipe: all 24 exit 0, includingnode scripts/check-sdui-manifest.mjsand its--self-test, andpnpm --dir ui exec vitest run scripts/under the verify lock.dispatch-gates --ran: 24 derived, 24 run, 0 NOT-MEASURED.dispatch-gates --tier: no path-derived mandate. 109 changed lines, under the 3000 threshold; no governed path. Every family CI runs is read from this PR's check-runs.Human Minimum
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01JQwxbW6EicqdfE9onssvrp
Generated by Claude Code