(core) fix closing of the search bar

Summary:
   - Sending `ESCAPE` while hovering the options panel was not working
   - This is because of the keepExpanded flag which was set to true
   - Solution is to set the keepExpanded flag to false, prior to toggling the Menu

Test Plan:  - Tested manually

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D2836
This commit is contained in:
Cyprien P 2021-05-25 14:24:36 +02:00
parent 7758cb830d
commit 8c6148dd9f

View File

@ -144,7 +144,7 @@ export function searchBar(model: SearchModel, testId: TestId = noTestId) {
)),
dom.onKeyDown({
Enter: () => model.findNext(),
Escape: () => toggleMenu(false),
Escape: () => { keepExpanded = false; toggleMenu(false); },
// Catch both Tab and Shift+Tab to prevent focus entering unrelated editable label.
Tab: () => toggleMenu(false),
}),