fix(pickers): rework B02 against the public review

Restore native clearing, unify the form/field protocol with the other choice
families (per-key entries, disabled and removed keys omitted, shared form
owner), synchronise ComboBox text by key identity, keep filtering out of open
composition sessions, and stop stealing focus when a controlled close is
rejected. Also merge caller refs/ARIA/disabled, implement asChild, autoFocus
and ComboBox variant, use a locale-aware base matcher, and put the indicator
class and slot on the icon element the ported CSS selects.
This commit is contained in:
maoyingjie
2026-10-25 20:40:24 +08:00
parent 3e9be13b19
commit e34b9debdf
24 changed files with 1808 additions and 236 deletions
+12 -11
View File
@@ -179,19 +179,20 @@ describe("Autocomplete docs and demos", () => {
mounted.push(wrapper);
await nextTick();
await settle();
const hidden = [
...(wrapper.element as HTMLElement).querySelectorAll<HTMLInputElement>(
'input[type="hidden"][name]',
),
];
expect(hidden.map((input) => input.name).sort()).toEqual([
"country",
"state",
]);
const root = wrapper.element as HTMLElement;
const pickerForm = (
root.matches("form") ? root : root.querySelector("form")
)!;
// Empty required pickers submit no entry; the Form guard blocks the submit.
expect(new FormData(pickerForm as HTMLFormElement).has("state")).toBe(
false,
);
expect(new FormData(pickerForm as HTMLFormElement).has("country")).toBe(
false,
);
// `Form` renders novalidate and guards submit itself: an empty required
// field must keep the demo's status line empty.
const root = wrapper.element as HTMLElement;
const form = (root.matches("form") ? root : root.querySelector("form"))!;
const form = pickerForm;
const submit = (
wrapper.element as HTMLElement
).querySelector<HTMLButtonElement>('button[type="submit"]')!;