Skip to content

AddressField / GeolocationField 子输入使用硬编码固定 id(street/city/latitude…)——同表单出现两个该类型字段即产生重复 DOM id #3343

Description

@xuyushun441-sys

packages/fields/src/widgets/AddressField.tsxGeolocationField.tsx 的子输入用的是硬编码字面量 id:

  • AddressField:id="street" / "city" / "state" / "zipCode" / "country"
  • GeolocationField:id="latitude" / "longitude"

后果:

  1. 一个表单(或一个页面)里出现两个 address / geolocation 字段时产生重复 DOM idLabel htmlFor 的关联随之指向第一个匹配元素——第二个字段的每个子 label 点击/朗读都落在第一个字段的输入上。
  2. 这些 id 还会覆盖 form renderer 经 FormControl Slot 注入的 formItemId,行级 FormLabelhtmlFor 因此永远指不到任何控件。

修法参照同目录惯例:useId() 前缀 + 子字段名(RadioField / CheckboxesFieldgroupId 即此范式)。

发现于 #3318 的 aria-invalid 交付批次(该批次只处理 aria-invalid 送达,刻意未顺手改 id 结构)。


Generated by Claude Code

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions