If I have a page where the whole page is scrollable, and there are also some scrollable child elements inside it (e.g. they have overflow and a normal js scrollbar), can I conditionally disable scrolling the child elements? in many cases the user will probably just want to scroll the outer page rather than the child element their mouse is over. We have considered that it is generally sort of an anti pattern in UI design to have scrollable child elements like this but it is needed.
I tried for example using capture event handling but not sure if I had the right setup
I also tried some solution that mentions conditionally maybe adding overflow:hidden like here How to prevent scrolling in a child from scrolling its parent, but this actually makes it so that the scroll state of the child element is not preserved (e.g. it snaps the child scroll back to the top)