-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Menus showing up off screen #8
Comments
Hey there - hmm, yea seems strange as the The What modal component are you using? It's tough to get a good idea of what's going on because there could be a lot going on with that. If you can make a simple repro git that demonstrates this issue then I'll dig into it for sure. I would say - I noticed you have Sorry you're having issues - I'll be standing by. |
I created a stripped down version of my project and your menu system is working fine in that context. I must have some CSS somewhere that is clobbering the generated top/left coordinates. My project has taken a different turn where I no longer need context menus. I don't think it makes sense to pour any more time into this rabbit hole. Thx for responding. |
Hi @johndatserakis, By inspection, I see that "top left" dynamic values (especially the top) assigned to the element are probably huge. Please see if you can help me out. Thanks in advance. |
@justintilson - ok hmm yea maybe something was giving it trouble. Hopefully it goes better next time you try to use it. @kofiasare - Hmm, the user above wasn't able to replicate the issue in a clean project. Are you able to replicate this in a repro project so I can take a look? Sometimes there may be some other css in your project that's causing an issue. In my use I really have never had the menu not show up in the right spot so it's tough for me to debug the issue. In your screenshot where did you click to show the menu? The top and left values don't seem too large - but it depends on where you clicked of course. Let me know. |
Hey @kofiasare - any update or reproduction project I can look at to help out? Thanks |
Let me know if you continue to have trouble with this - closing for now. |
I have the same issue and I think it is because I use a vue-instance only on a part (see red border area) of a web-app. The blue spot is the point I clicked to open the menu. So the width and height of the left respectively top area is added, but should not. Maybe use clientX over pageX? |
Ok let me look into this - thanks a bunch for the link and catching another example of the issue. |
Ok so I did some tests using Attached are 2 screenshots - one I had my browser full size on my screen, and the second I had the bottom pulled up a bit. As you can see in the second screenshot, the menu is way off. For reference - I clicked right on tip of the J in Jim. I don't think the issue is due to the @dnalneh - do you have an example repo where I can dig into this a bit? I haven't been able to reproduce the issue myself so I'd like to have an example to look into. |
@johndatserakis This is my current workaround, maybe it will help other people:
|
Ok great - thanks for that. Maybe if we find out what exactly is causing the once-in-a-while issue then we can implement this fix in real time. I'll be keeping an eye on this. |
I have the same issue. The context menu is off-screen, but it seems to be override-able just using one CSS left value with important. I feel it may have to do with the fact my context menus need to popup from a sidebar menu that's already using fixed positioning. |
Hmm ok I see - thanks for the detail. Maybe the Sorry to all for this issue. It's been tough to capture it in action. If anyone has a public example of the issue I'm totally down to dive in. It's definitely a tricky one considering the positioning factors. Hopefully the fixes from @dnalneh and @drewstaylor can help in a pinch. |
I fixed it by forcing fixed positioning:
Since you are using left with the mouse events x value, the menu is completly out of my screen too |
It tried
That worked for me |
I have the same issue, even with position fixed, because my contextmenu is inside a component, when it's rendered, it's offscreen (the component is placed as a right sidebar), if I override it to left: 0: top:0; it's apearing on the top left of the component, not the main screen. I'm still trying to figure it out, how to get it out of the component, as dymically as it can be. So far, only @johndatserakis workaround worked for me. |
The issue is with modern style frameworks using padding/margins on components for positioning. Position absolute will position absolute to the parent element (in this case the first element with set positioning) - thus ignoring the flow among its siblings - but not outside the flow of surrounding components. |
Adding position fixed doesn't work if your website scrolls. |
I too have had this issue. I figured out the problem is CSS related by hacking the menu to open at (0,0). Doing so, the menu appeared in the top left of the right-hand pane in my 2 column design (ie. not in the very top left of the screen). This then throws off the X/Y calculations, which are based on the entire screen. In other words, the calculation "thinks" the screen is 900px wide (which it is), but position (0,0) is actually about (300,0), so the menu is placed 300px further to the right than it should be. In my case, my right-hand pane (ie. a container div, probably half a dozen parents up from the context menu) had |
Good afternoon. The shift occurs if the context menu is not located in the visual root.
In this case, all shifts are counted from document.firstElementChild. |
position: fixed only places the element relative to the viewport when no ancestor element has transform, perspective or filter property set. |
I'm trying to get your context menus working in a modal 'window' but they are not displaying where the right click occurs, instead they seem to be hanging off the bottom of the screen. It's not a z-index issue as yours (10000) is way higher than mine (1000). The following screenshot is the best way I can think of to illustrate what is going on:
I'm quite certain I've set up my template as per your instructions.
CSS is imported and successfully hiding the content of
:options
The showMenu function is being called as expected. Seems like a CSS conflict of some sort.
Any suggestions on where to poke at the CSS?
EDIT: If I manually change the top and left values in Chrome's Inspect window, I'm able to get move the menu on to the screen.
The text was updated successfully, but these errors were encountered: