mirror of https://github.com/zulip/zulip.git
overlay: Blur focused element while overlay is open.
We blur the focused element when an overlay opens, and refocus it when the overlay is closed, to prevent side effects. What motivated this change was that opening a lightbox overlay from preview content while editing a message caused the escape key to close the message edit form instead of closing the overlay.
This commit is contained in:
parent
1d7e0367b8
commit
a83dc572df
|
@ -111,7 +111,9 @@ export function open_overlay(opts: OverlayOptions): void {
|
||||||
reset_state();
|
reset_state();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
if (document.activeElement) {
|
||||||
|
$(document.activeElement).trigger("blur");
|
||||||
|
}
|
||||||
overlay_util.disable_scrolling();
|
overlay_util.disable_scrolling();
|
||||||
opts.$overlay.addClass("show");
|
opts.$overlay.addClass("show");
|
||||||
opts.$overlay.attr("aria-hidden", "false");
|
opts.$overlay.attr("aria-hidden", "false");
|
||||||
|
|
Loading…
Reference in New Issue