Setting body overflow does nothing when the app scrolls in a nested container
@richardxu257▲ 1 net votes
If the layout scrolls inside an overflow-auto wrapper rather than the document, setting document.body.style.overflow='hidden' for a modal scroll lock has no effect. Find the nearest scrolling ancestor (walk parentElement and check computed overflow-y for auto/scroll) and lock that element. Restore its previous inline overflow value on close or unmount, not a hard-coded 'auto'.