diff --git a/app/assets/javascripts/discourse/app/lib/body-scroll-lock.js b/app/assets/javascripts/discourse/app/lib/body-scroll-lock.js index 9b157aede2a..f6ea841f6b8 100644 --- a/app/assets/javascripts/discourse/app/lib/body-scroll-lock.js +++ b/app/assets/javascripts/discourse/app/lib/body-scroll-lock.js @@ -41,7 +41,7 @@ const isIosDevice = (/iP(ad|hone|od)/.test(window.navigator.platform) || (window.navigator.platform === "MacIntel" && window.navigator.maxTouchPoints > 1)); -let locks = []; +export let locks = []; let locksIndex = /* @__PURE__ */ new Map(); let documentListenerAdded = false; let initialClientY = -1; diff --git a/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-collection.js b/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-collection.js index b4c012e646c..cf9ec5c3eeb 100644 --- a/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-collection.js +++ b/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-collection.js @@ -5,6 +5,7 @@ import { modifier } from "ember-modifier"; import { disableBodyScroll, enableBodyScroll, + locks, } from "discourse/lib/body-scroll-lock"; @tagName("") @@ -16,10 +17,18 @@ export default class SelectKitCollection extends Component { return; } - disableBodyScroll(element); + const isChildOfLock = locks.some((lock) => + lock.targetElement.contains(element) + ); + + if (isChildOfLock) { + disableBodyScroll(element); + } return () => { - enableBodyScroll(element); + if (isChildOfLock) { + enableBodyScroll(element); + } }; }); }