fix(menus): one tick for every choice; a listbox holds its options only
- The saved views, the view switcher, the year filter and the table's single-choice filter mark the chosen row with MenuCheck, as DESIGN asks, not a trailing tick, a dot or a filled row; a contract test holds every checkable menu row to it. keepSelectedPaint had no caller left and is gone. - A combobox's panel carries its listbox role on an inner PopoverList (listInside), so the failed load, Loading, No matches and the 'n more' line sit beside the options, not inside the listbox. The Plex search box's Loading line likewise. - The Plex sidebar's playlist picker offers Create only once the lists have loaded: over a failed load it pushed the error and its Retry out at the first keystroke.
This commit is contained in:
@@ -339,6 +339,35 @@ describe("Combobox · honest states", () => {
|
||||
expect(document.activeElement).toBe(field);
|
||||
});
|
||||
|
||||
// Round 2 (F4): a listbox may own options only — the alert, "Loading…", "No matches" and the
|
||||
// "n more" line sat inside it (axe: aria-required-children). They sit beside it now.
|
||||
it("keeps the lines about the list outside the listbox, which the field still controls", () => {
|
||||
const { rerender } = wrap(
|
||||
<Combobox label="User" options={[]} selected={[]} onChange={vi.fn()} error="Load failed" />,
|
||||
);
|
||||
const field = screen.getByRole("combobox");
|
||||
field.focus();
|
||||
fireEvent.focus(field);
|
||||
const listbox = () => screen.getByRole("listbox", { hidden: true });
|
||||
expect(field.getAttribute("aria-controls")).toBe(listbox().id);
|
||||
expect(listbox().getAttribute("aria-label")).toBe("User");
|
||||
expect(listbox().contains(screen.getByRole("alert", { hidden: true }))).toBe(false);
|
||||
rerender(
|
||||
<FloatingTree>
|
||||
<Combobox label="User" options={[]} selected={[]} onChange={vi.fn()} />
|
||||
</FloatingTree>,
|
||||
);
|
||||
expect(listbox().textContent).toBe("");
|
||||
rerender(
|
||||
<FloatingTree>
|
||||
<Combobox label="User" options={OPTIONS} selected={[]} onChange={vi.fn()} />
|
||||
</FloatingTree>,
|
||||
);
|
||||
const kids = [...listbox().children].map((c) => c.getAttribute("role"));
|
||||
expect(kids.length).toBeGreaterThan(0);
|
||||
expect(kids.every((r) => r === "option")).toBe(true);
|
||||
});
|
||||
|
||||
it("disabled: keeps the focus, opens nothing and picks nothing", () => {
|
||||
const onChange = vi.fn();
|
||||
wrap(<Combobox label="Genre" options={OPTIONS} selected={[]} onChange={onChange} disabled />);
|
||||
|
||||
Reference in New Issue
Block a user