🐛(react) fix closing of menu via toggle button

Previously it was not possible to close the menu when clicking on
the toggle button on search select. It was caused by a conflicting
state update.
1. Downshift triggers closing the menu from getToggleButtonProps
2. wrapperProps was calling downshiftReturn.openMenu()
This commit is contained in:
Nathan Vasse
2023-11-28 16:28:00 +01:00
committed by NathanVss
parent b25aa8f078
commit 7ddcfeb4bc
5 changed files with 20 additions and 7 deletions

View File

@@ -1247,7 +1247,7 @@ describe("<Select multi={true} />", () => {
await user.type(input, "Par");
expectOptions(["Paris"]);
await user.type(input, "{enter}");
await user.type(input, "{enter}", { skipClick: true });
await waitFor(() => expectSelectedOptions(["Paris"]));
});
@@ -1504,9 +1504,9 @@ describe("<Select multi={true} />", () => {
const user = userEvent.setup();
await user.click(input);
await waitFor(() => expectOptions(["Paris", "New York", "Tokyo"]));
await user.type(input, "New");
await user.type(input, "New", { skipClick: true });
await waitFor(() => expectOptions(["New York"]));
await user.type(input, "{enter}}");
await user.type(input, "{enter}}", { skipClick: true });
expectSelectedOptions(["London", "New York"]);
screen.getByText('Value = ["london","new_york"]|');