/** * Defined in `Dimmer.less` */ const NO_SCROLL_CLASS = 'no-scroll'; /** * Apply {@link NO_SCROLL_CLASS} that disables scroll on page (e.g use in Dimmer to disable scroll behind the component) * * CSS class needs to be applied for `html` and not `body`, as this doing both will break any position sticky in the document. */ export const addNoScrollClass = () => { document.documentElement.classList.add(NO_SCROLL_CLASS); }; /** * Clean up after {@link addNoScrollClass} function */ export const removeNoScrollClass = () => { document.documentElement.classList.remove(NO_SCROLL_CLASS); };