-
Notifications
You must be signed in to change notification settings - Fork 38
Fixes #10 #17
base: master
Are you sure you want to change the base?
Fixes #10 #17
Conversation
Removes the need for a menu container that covers the page. This way, we can can catch the clicked target and close the menu as needed.
If menu is triggered on a page higher than the viewport, setting overflow: hidden on the body will make the content 'jump' to the right on operating systems that make the scrollbar take up space in the browser (i.e. Windows). Following up on the previous commit, this is no longer necessary.
There's actually no need to check for clicks inside the container or items. As long as the context menu is found in the DOM, close() will simply remove it.
After the removal of the backdrop div, clicking two different basicContext-enabled elements would show the same menu on the second click. This fixes that behavior by always removing any menu before creating one.
Looks good and works very well. Thanks! We just need to get around the mentioned |
Not sure which one that is, is it not working as expected?
That's already covered in the last commit (3376994). Clicking a different basicContext-enabled element while the menu is already open on one, produces the expected behavior: currently opened menu is removed, and the new one is opened on the new element that was clicked. Or, maybe I'm missing something? |
The demos all work fine, because this case isn't covered. I also see a problem with not blocking scrolling (previously done via |
Thanks for the explanation. For the For the overflow/scroll, could we have it enabled just in the case of scrollable context menus? Looking at the default browser context menu in Windows, indeed you can't scroll when it's opened; but then again, it also doesn't remove the scrollbar. |
@hellocosmin What's the status of this PR? Is preventing default behaviour on right-click of basicContextContainer an intermediate solution for this problem? |
Removes the need for a menu container that covers the page. This way, we can catch the clicked target and close the menu as needed.