react-contexify icon indicating copy to clipboard operation
react-contexify copied to clipboard

How to close contex menu when scrolling

Open NemanjaS2P opened this issue 5 years ago • 5 comments

if I click on a page and the contex menu opens i want it to close when i scroll the page. Is there a property to set where i hide the menu on scroll? Thank you

NemanjaS2P avatar Dec 23 '20 09:12 NemanjaS2P

Hey @NemanjaS2P, this is already the default behavior.

https://user-images.githubusercontent.com/5574267/102987372-7c2d3f00-4512-11eb-8189-a19f7db10b9a.mov

If it's not your case, could you share the code in a code sanbox ? Thanks

fkhadra avatar Dec 23 '20 10:12 fkhadra

Hey @NemanjaS2P, this is already the default behavior.

Screen.Recording.2020-12-23.at.11.31.02.AM.mov If it's not your case, could you share the code in a code sanbox ? Thanks

Open a custom scroll area to close the context-menu? It can't seem to work well in custom scroll area. See this code sanbox example: https://codesandbox.io/s/nifty-fermat-ljldf?file=/src/App.tsx:348-359

yepyeel avatar Jan 06 '21 08:01 yepyeel

Hey @NemanjaS2P, this is already the default behavior. Screen.Recording.2020-12-23.at.11.31.02.AM.mov If it's not your case, could you share the code in a code sanbox ? Thanks

Open a custom scroll area to close the context-menu? It can't seem to work well in custom scroll area. See this code sanbox example: https://codesandbox.io/s/nifty-fermat-ljldf?file=/src/App.tsx:348-359

Yes I am able to reproduce this as well. We can make it sticky with scroll or it should have an option to automatically hide/close it.

aditya-padhi-kbl avatar Jan 12 '21 20:01 aditya-padhi-kbl

I have the same problem. The property that causes this problem is:

height:calc(100vh - 52px);

and this is the full class applied on my page:

{
  position: relative;
  overflow-y: scroll;
  overflow-x: hidden;
  height: calc(100vh - 52px);
  transition: all 0.5s ease-in-out;
}

ShahriarKh avatar Jul 13 '22 19:07 ShahriarKh

As a workaround you could close the menu programmatically, for example, you can listen for the scroll on the target and then close the menu

target.addEventListener("scroll", () => contextMenu.hideAll())

fkhadra avatar Nov 05 '22 21:11 fkhadra