Skip to content

Combobox trigger 按钮缺省 type —— 在表单内点击会以 submit 语义提交表单 #3344

Description

@xuyushun441-sys

packages/components/src/custom/combobox.tsx 的 trigger Button 没有显式 type 属性。HTML 缺省下 <button> 在表单内是 type="submit",而 Radix PopoverTrigger 的 onClick 不做 preventDefault——于是在任何 <form> 内(如对象表单里的 object-ref / recipient-picker 字段 widget)点击下拉触发按钮会同时触发一次表单提交/校验

对照:LookupField 的 trigger、MultiSelectField 的 chips、RatingField 的星标都显式写了 type="button"SelectTrigger(Radix Select)自带 type="button"。Combobox 是目前的漏网者。

修法一行:给该 Button 加 type="button"(消费方仍可经 props 覆盖——#3318 起 Combobox 会把标准 button 属性转发到 trigger)。

发现于 #3318 的 aria-invalid 交付批次(为 Combobox 增加 trigger pass-through 时读到,未顺手修以免在同一 PR 里混入行为变更)。


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