(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
pull/9/head
Cyprien P 3 years ago
parent 7758cb830d
commit 8c6148dd9f

@ -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),
}),

Loading…
Cancel
Save