You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
label ... for="_r_2_-form-item" 文本 WEmpty
div data-testid="select-empty-wempty" class="... h-9" 文本 No options available
即 for悬空 —— 指向一个文档里没有任何元素携带的 id。 getByLabelText('WEmpty') 抛
"Found a label with the text of: WEmpty, however no form control was found associated to that label"。
宿主侧不能顺手扩过来,这正是 #3991 没有一起修的原因:第三方完全可以注册一个 field 冒号 select,在空选项时渲染一个真实控件;宿主基于猜测抹掉 for,
会把一个本来正确的 widget 的关联打断。#3991 的 PR 里对这一条留了正面 pin。
四个选项 widget 里只有 select 受影响
FIELD_WIDGET_LABELLING 声明 multiselect / radio / checkboxes 为 'group',
它们的空状态已经由 objectui#3990 / #4005 修好 —— 实测 field 冒号 radio 空选项:
label="REmpty" for=null (改为发布 id="..._group-label")
div id="..." aria-labelledby="..._group-label" aria-describedby="..." role="group"
select 声明的是 'control',没有这条 IDREF 通道,所以只有它落在这个状态里。 OptionsEmptyState 的 hostGroupProps 注释也把这一条写明了:
"Absent for the single SelectField — it is not group-labelled, its label still uses a plain for"。
拆自 objectui#3991 的实测:那张卡按 arm 1 修了内建
select分支(无控件 ⇒ 不发for),并实测出注册 widget 路径是同一缺陷类、不同机制,按派发裁决「说明并留下」,故单独立此卡。
实测(objectui#3991 的 worktree,
origin/main@b6d07df4b)用真实的
@object-ui/fieldswidget + 真实表单渲染器,一个{ name: 'wempty', label: 'WEmpty', type: 'field' 冒号 'select', options: [] }:渲染出的行(去掉尖括号写法):
即
for悬空 —— 指向一个文档里没有任何元素携带的 id。getByLabelText('WEmpty')抛"Found a label with the text of: WEmpty, however no form control was found associated to that label"。
与 objectui#3991 的内建分支同形,但不是同一个机制
select(#3991 已修)field冒号select(本卡)form.tsx的renderFieldComponent)SelectField,另一个包)...rest)for指向不可 label 的 divfor悬空,无 ownerComponentRegistry解析宿主侧不能顺手扩过来,这正是 #3991 没有一起修的原因:第三方完全可以注册一个
field冒号select,在空选项时渲染一个真实控件;宿主基于猜测抹掉for,会把一个本来正确的 widget 的关联打断。#3991 的 PR 里对这一条留了正面 pin。
四个选项 widget 里只有
select受影响FIELD_WIDGET_LABELLING声明multiselect/radio/checkboxes为'group',它们的空状态已经由 objectui#3990 / #4005 修好 —— 实测
field冒号radio空选项:select声明的是'control',没有这条 IDREF 通道,所以只有它落在这个状态里。OptionsEmptyState的hostGroupProps注释也把这一条写明了:"Absent for the single
SelectField— it is not group-labelled, its label still uses a plainfor"。影响面(与 #3991 同样诚实)
getByLabelText抛错,读起来像渲染器坏了,而实际是正确渲染的空状态。方向属于裁决,这里不预设
至少三条,和 #3991 当初的三岔一样,且这次不能直接照搬它的结论(那条结论的成立前提是宿主拥有分支):
SelectField的空分支把 host 的 pass-through 交给那个 div(会得到 [components] 内建 select 的空选项/依赖门态分支把 host id 落在一个 div 上 —— label 的 for 指向不可 label 元素,仍是不关联的 #3991 刚判定为惰性的形状);select一条labelling侧的声明,让宿主像 group 那样知道空态无控件;hostGroupProps通道(但select不是 group-labelled,这等于改它的 labelling 归类)。
参考
field冒号select的 aria pass-through,有选项的那条路径)Generated by Claude Code