fix: reveal Select focus after floating positioning
This commit is contained in:
@@ -694,3 +694,22 @@ it("keeps locally disabled options out of the native submission even with explic
|
||||
expect(data()).toEqual([]);
|
||||
expect(w.get('[data-slot="select-value"]').text()).toBe("Alpha");
|
||||
});
|
||||
|
||||
it("reveals only the currently focused owned option after popup positioning starts", async () => {
|
||||
const w = fixture(`<Select default-value="last">${content}</Select>`);
|
||||
await trigger(w).trigger("click");
|
||||
await flushPromises();
|
||||
const active = option(3);
|
||||
const reveal = vi.fn();
|
||||
active.scrollIntoView = reveal;
|
||||
const popup = document.querySelector<HTMLElement>(
|
||||
'[data-slot="select-popover"]',
|
||||
)!;
|
||||
popup.dispatchEvent(new Event("animationstart", { bubbles: true }));
|
||||
expect(reveal).toHaveBeenCalledOnce();
|
||||
active.dispatchEvent(new Event("animationstart", { bubbles: true }));
|
||||
expect(reveal).toHaveBeenCalledOnce();
|
||||
(trigger(w).element as HTMLElement).focus();
|
||||
popup.dispatchEvent(new Event("animationstart", { bubbles: true }));
|
||||
expect(reveal).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user