mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
hotkey: Close text fields before closing sidebar.
Before this change, we'd try to close the sidebar before closing text fields. This means if the user sidebar was open with a text search in progress, pressing Escape would close the full sidebar instead of closing search. This change deprioritizes closing the sidebar, in favor of closing input fields like search. This also helps with #26717, because the sidebar seems to be marked as open even when it's not an overlay, which means pressing Escape will first "close" it (no visual changes), before a second Escape would trigger closing the search field. Ideally we differentiate between situations where we are showing the sidebar as an overlay and when we aren't, but that might be a more involved change.
This commit is contained in:
@@ -272,13 +272,12 @@ export function process_escape_key(e) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (popovers.any_active() || sidebar_ui.any_sidebar_expanded_as_overlay()) {
|
||||
if (popovers.any_active()) {
|
||||
if (user_card_popover.manage_menu.is_open()) {
|
||||
user_card_popover.manage_menu.hide();
|
||||
$("#user_card_popover .user-card-popover-manage-menu-btn").trigger("focus");
|
||||
return true;
|
||||
}
|
||||
sidebar_ui.hide_all();
|
||||
popovers.hide_all();
|
||||
return true;
|
||||
}
|
||||
@@ -350,6 +349,11 @@ export function process_escape_key(e) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sidebar_ui.any_sidebar_expanded_as_overlay()) {
|
||||
sidebar_ui.hide_all();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (compose_state.composing()) {
|
||||
compose_actions.cancel();
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user