Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

overlay_util: Correctly handle overflow behavior in the application.

whilstsomebodyef201f4fedd8
diff --git a/web/src/modals.ts b/web/src/modals.ts
index 051a25e465e..f41d096cb7e 100644
--- a/web/src/modals.ts
+++ b/web/src/modals.ts
@@ -4,6 +4,7 @@ import assert from "minimalistic-assert";
import * as blueslip from "./blueslip.ts";
import * as overlay_util from "./overlay_util.ts";
+import * as overlays from "./overlays.ts";
type Hook = () => void;
@@ -162,7 +163,14 @@ export function open(
if (conf.on_show) {
conf.on_show();
}
- overlay_util.disable_scrolling();
+ // We avoid toggling scrolling when opening a modal over an active overlay.
+ // This prevents a subtle UI shift, as reported in
+ // https://chat.zulip.org/#narrow/channel/9-issues/topic/A.20little.20right.20shift.20can.20be.20observed.20when.20confirm.20dialog.20ope/near/2026160
+ // There is no need to enable or disable the scrolling when modal is
+ // opened because it is already handled while opening and closing the overlay.
+ if (!overlays.any_active()) {
+ overlay_util.disable_scrolling();
+ }
call_hooks(pre_open_hooks);
}
@@ -170,7 +178,11 @@ export function open(
if (conf.on_hide) {
conf.on_hide();
}
- overlay_util.enable_scrolling();
+ // Since we are disabling scroll only when the modal is not
+ // opened over an overlay, we will enable it in that way only.
+ if (!overlays.any_active()) {
+ overlay_util.enable_scrolling();
+ }
call_hooks(pre_close_hooks);
}