Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

[fields] 只读 / 零选项的 group-labelled 选项 widget 提前 return,groupDomProps 没被展开 —— host label 的 IDREF 没有消费者,标签仍然什么都不命名(#3961 的残留,checkboxes 今天的 main 上就这样) #3990

Closed

Description

@yinlianghui

在 #3975(PR #3983)的验证过程中实测到的一条,与那个 PR 无关也不由它引入:checkboxes 在今天的 main 上就是这个形态。单独立单。

实测

一次性 probe(未提交),真 form renderer + 裸注册(labelling: 'group'),读 host label 的 for / 自身 id / 文档里 aria-labelledby 消费者的个数:

multiselect  readonly:true   for=(none)  labelOwnId=…-group-label  ariaLabelledbyConsumers=0  namedGroups=0  byLabelText=0
checkboxes   readonly:true   for=(none)  labelOwnId=…-group-label  ariaLabelledbyConsumers=0  namedGroups=0  byLabelText=0
multiselect  options:[]      for=(none)  labelOwnId=…-group-label  ariaLabelledbyConsumers=0  namedGroups=0  byLabelText=0
multiselect  mode:'view'     for=(none)  labelOwnId=…-group-label  ariaLabelledbyConsumers=1  namedGroups=1  byLabelText=1   ← 正常
multiselect  可编辑(对照)  for=(none)  labelOwnId=…-group-label  ariaLabelledbyConsumers=1  namedGroups=1  byLabelText=1   ← 正常

即:字段级 readonly: true,以及零个可选项这两种状态下,可见标签是 0 个元素的可访问名。整个表单级 mode: 'view' 不受影响(它不走 widget 的 readonly 分支)。

机理

labelling: 'group' 的字段,form renderer 让 label 发布自己的 id 并撤掉 for(#3961 的正确修法),把 aria-labelledby 交给 widget —— 但这些 widget 的提前 return 分支根本不展开 groupDomProps:

  • packages/fields/src/widgets/MultiSelectField.tsx:61-73 的 readonly 分支,返回 div.flex.flex-wrap.gap-1 + 一排 Badge,不带 id、不带 aria-labelledby;CheckboxesField.tsx:60-72 逐字同形;
  • MultiSelectField.tsx:79-89 / CheckboxesField.tsx:78-88 的零选项分支返回 OptionsEmptyState,同样不展开。

于是 IDREF 只有生产者、没有消费者。这类失效比 #3961 修的那种更安静:for 悬空至少还能被「每个 for 都要解析到可 label 元素」的扫描看见,而「label 发了 id 但没人引用它」在标记里看不出任何异常。

与 #3961 / #3975 的关系(重要:不是回归)

两侧都是坏的,严重程度未变,只是形状从「悬空 for」变成「无人消费的 IDREF」。所以这既不是 #3961 的回归,也不是 #3983 的回归,而是那次修法没有覆盖到的状态。#3961 的 e2e 钉全部在可编辑态取样,这正是它漏过的原因。

覆盖面

已实测:checkboxes、multiselect(readonly + 零选项)。未实测:radio / rating / file / address / geolocation 的 readonly 分支各自写法不同,需逐个量,不要按本单推断。

处置方向(未裁决)

参考

Activity

  1. yinlianghui commented on Aug 9, 2026

    @yinlianghui
    ContributorAuthor

    PM 分诊轮(session_01GTRjn8xBqp75dk7kFupVRt):晋级 pm:queue。理由:#3961/#3975 家族的收口 —— 只读/零选项态提前 return 使 groupDomProps 未展开,host label 发了 id 却无 IDREF 消费者(修前悬空 for、修后无人消费,两侧都不命名,非回归但也未修);方向沿既定 group 机制(只读分支同样展开 groupDomProps / 补 role)。正文已警告 radio/rating/file/address/geolocation 的只读分支写法各异不可推断 —— 派发词将要求逐 widget 实测后处置。前置:PR3983 合入后派(同 fields 面)。


    Generated by Claude Code

  2. self-assigned this
    on Aug 9, 2026
  3. yinlianghui commented on Aug 9, 2026

    @yinlianghui
    ContributorAuthor

    🔒 认领(objectui 分片 PM,session_01GTRjn8xBqp75dk7kFupVRt,批次 6):前置 PR #3983 已落 main(d8a0be424)。分支 claude/issue-3990-readonly-group-label;范围按分诊评论:group-labelled widget 的只读/零选项态收口(提前 return 分支同样展开 groupDomProps / 补 role),正文警告的「各 widget 只读分支写法各异」→ 逐 widget 实测后处置,不可推断。文件面:packages/fields/src/widgets/** + 测试;与同批各单不相交。


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions