more general solution

This commit is contained in:
Joffrey JAFFEUX 2024-12-12 14:07:17 +01:00 committed by Penar Musaraj
parent a28c825147
commit b9b6e8b011
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) || (/iP(ad|hone|od)/.test(window.navigator.platform) ||
(window.navigator.platform === "MacIntel" && (window.navigator.platform === "MacIntel" &&
window.navigator.maxTouchPoints > 1)); window.navigator.maxTouchPoints > 1));
let locks = []; export let locks = [];
let locksIndex = /* @__PURE__ */ new Map(); let locksIndex = /* @__PURE__ */ new Map();
let documentListenerAdded = false; let documentListenerAdded = false;
let initialClientY = -1; let initialClientY = -1;

View File

@ -5,6 +5,7 @@ import { modifier } from "ember-modifier";
import { import {
disableBodyScroll, disableBodyScroll,
enableBodyScroll, enableBodyScroll,
locks,
} from "discourse/lib/body-scroll-lock"; } from "discourse/lib/body-scroll-lock";
@tagName("") @tagName("")
@ -16,10 +17,18 @@ export default class SelectKitCollection extends Component {
return; return;
} }
const isChildOfLock = locks.some((lock) =>
lock.targetElement.contains(element)
);
if (isChildOfLock) {
disableBodyScroll(element); disableBodyScroll(element);
}
return () => { return () => {
if (isChildOfLock) {
enableBodyScroll(element); enableBodyScroll(element);
}
}; };
}); });
} }