ngx-contextmenu icon indicating copy to clipboard operation
ngx-contextmenu copied to clipboard

Problem with context menu position

Open HATyCEHKA opened this issue 8 years ago • 13 comments

In some situations context menu is opened from bottom and upper elements are hidden. But if I right click a little upper it is opened correctly/ screenshot_3 screenshot_4

HATyCEHKA avatar Oct 02 '17 10:10 HATyCEHKA

The context menu tries to position itself so that the largest area of the context menu is visible in the viewport. Your screenshots look like that logic isn't working correctly though. Did you have to scroll to see all of the context menu in your second screenshot?

I like the design of your context menu by the way. Having keyboard shortcuts right aligned is a nice touch.

isaacplmann avatar Oct 02 '17 13:10 isaacplmann

No scroll, just right click a little upper

HATyCEHKA avatar Oct 02 '17 13:10 HATyCEHKA

I found if Y of right click is lower than center of the area contex menu is always opened at this position by bottom (like 1st screen).

HATyCEHKA avatar Oct 02 '17 13:10 HATyCEHKA

This is obviously not working the right way, but fixing it will take some work. I'm planning to tear out my custom positioning logic and hand that work off to the @angular/cdk Overlay service. That should solve this issue and probably also solve bugs I haven't even thought of yet. I'm not sure what the timeline will be for this fix.

isaacplmann avatar Oct 03 '17 12:10 isaacplmann

FYI, I'm working on the version with @angular/cdk in the cdk branch.

isaacplmann avatar Oct 11 '17 20:10 isaacplmann

Try this again in 2.0.0-beta.1 please

isaacplmann avatar Oct 24 '17 20:10 isaacplmann

I installed new version from npm, but I have error: ERROR in ./app/app.module.ts Module not found: Error: Can't resolve 'ngx-contextmenu' .

I don't now how to make this work

HATyCEHKA avatar Oct 25 '17 08:10 HATyCEHKA

Sorry about that, I compiled with angular 5.x which broke it for use with 4.x apps. 2.0.0-beta.2 is compiled with 4.x so it should work with 4.x and 5.x apps.

isaacplmann avatar Oct 25 '17 13:10 isaacplmann

Not working. It is still hidden image

HATyCEHKA avatar Oct 25 '17 15:10 HATyCEHKA

2.0.0-beta.4 falls back to vertically centering the context menu if it runs out of space on both sides. Let me know if that works for you.

isaacplmann avatar Oct 27 '17 18:10 isaacplmann

Almost, there is a problem with upper navbar. image

And if I make window smaller bottom part is hidden image

HATyCEHKA avatar Oct 30 '17 13:10 HATyCEHKA

I think this is the best I can do for now. The context menu can be entirely below the mouse location, entirely above or vertically centered on it.

Whenever issue 6534 in angular/material lands, I'll have the option to automatically add a scrollbar to the context menu if there isn't space. It looks like there hasn't been much work on it for the last 2.5 months though.

isaacplmann avatar Oct 30 '17 14:10 isaacplmann

Hi Isaac, Any update on this issue? Was there a solution offered for this? We are facing the same problem. It seems the problems happens with the library too. see image: ( Mostly when viewport height is small and context menu list is long). Is it possible to position it properly (for instance getting the coordinates of bounding box) and maybe add a scroll bar when after a certain max-height say 70vh or something?

image

Thanks!

mnyamor avatar Jun 16 '20 06:06 mnyamor