I have a submenu element, which appears when the user hovers over a menu item, and hides when(well you can guess when). I want to make it hide when the user scrolls the page.
I have added this hook in the submenu element, but the event listener does not fire. window.onscroll works, but it does not fit my needs.
Is there any general reason why react would not register the scroll event?
yes i always mess up that part, ill fix it and see if it still doesnt work
@kevinSmith the functionality is such that i want to register if the user is scrolling the whole page, not just certain element. I did check however if attaching listener to the “root” element should work, but it did not.
The whole problem came when i placed the submenu to be position fixed, so when i scroll, it doesnt float with the document. Position absolute had another positioning issues involved, so i did not use that