Skip to content

Commit

Permalink
improve modal scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
yesil committed May 27, 2024
1 parent 8af202e commit 78c9cda
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions creativecloud/deps/merch-sidenav.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// branch: catalog-regressions-4 commit: d3bd85e73193a2d92ab306f9363c2a2cb2f0a003 Mon, 27 May 2024 11:32:34 GMT
// branch: catalog-regressions-4 commit: d3bd85e73193a2d92ab306f9363c2a2cb2f0a003 Mon, 27 May 2024 11:38:02 GMT

Check warning on line 1 in creativecloud/deps/merch-sidenav.js

View workflow job for this annotation

GitHub Actions / Running eslint

[eslint] reported by reviewdog 🐶 File ignored because of a matching ignore pattern. Use "--no-ignore" to override. Raw Output: {"fatal":false,"severity":1,"message":"File ignored because of a matching ignore pattern. Use \"--no-ignore\" to override."}

// src/sidenav/merch-sidenav.js
import { html as html4, css as css5, LitElement as LitElement4 } from "/libs/deps/lit-all.min.js";
Expand Down Expand Up @@ -506,12 +506,8 @@ var MerchSideNav = class extends LitElement4 {
this.dialog,
options
);
document.documentElement.style.overflow = "clip";
document.documentElement.style.scrollbarGutter = "stable";
overlay.addEventListener("close", () => {
this.modal = false;
document.documentElement.style.overflow = "initial";
document.documentElement.style.scrollbarGutter = "initial";
});
this.shadowRoot.querySelector("sp-theme").append(overlay);
});
Expand All @@ -525,6 +521,18 @@ var MerchSideNav = class extends LitElement4 {
this.modal = true;
}
};
document.addEventListener("sp-opened", (e) => {
if (e.detail.interaction !== "modal" && e.detail.interaction !== "page")
return;
document.documentElement.style.overflow = "clip";
document.documentElement.style.scrollbarGutter = "stable";
});
document.addEventListener("sp-closed", (e) => {
if (e.detail.interaction !== "modal" && e.detail.interaction !== "page")
return;
document.documentElement.style.overflow = "initial";
document.documentElement.style.scrollbarGutter = "initial";
});
customElements.define("merch-sidenav", MerchSideNav);
export {
MerchSideNav
Expand Down

0 comments on commit 78c9cda

Please sign in to comment.