more general solution

This commit is contained in:
Joffrey JAFFEUX 2024-12-12 14:07:17 +01:00 committed by Penar Musaraj
parent 48bfb7ab0d
commit 7ed59b3bb6
2 changed files with 12 additions and 3 deletions

View File

@ -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;

View File

@ -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);
}
};
});
}