-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Popup appears in wrong spot when set manually before trigger is activated. #1065
Comments
I went through and I think I figured out what was wrong. Open isn't actually a prop of Popup, it is a prop of Portal and the example on the popup page takes advantage of the pass-through that Popup does. Popup relies on the event object in onOpen in order to find it's this.coords. My best guess would be that when the open prop is manually triggered there isn't an element to connect to that event so Popup gets lost. I'm not entirely sure what the fix would be. A really sketchy fix I just did for myself is that I fired a click event on the trigger to help the Popup find it's trigger. A much better solution would be to find a way to get the trigger element without having to cause DOM events because that's not a very React thing to do. |
I have stumbled upon this issue as well. However in my case using synthetic events somehow wreaks havoc on the whole event system and some other unrelated events are fired. Please fix this. |
It looks like the position is not being calculated at the correct time. PRs welcome. |
@levithomason I'm thinking of making popup stick to its trigger, because there are problems when I try to compute position when the trigger is rendered and then it changes position. |
I think this makes sense, if the trigger moves, the popup should move with it. |
I have added a PR for a possible fix for this here: |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions. |
I'm still seeing this, in my case I am controlling the popup from the outside by placing it inside a div container and opening it via the onContextMenu event of the div. |
Please see the linked PR #2389. Let's move any conversation on progress to there. |
What was the reason Portal was used for this? I think Popup should not be ripped out of the DOM and re-located. I believe this creates unnecessary complexity that could be solved more succinctly with basic css: Wrap the trigger in a container with a non-static (probably I put together a very simple example: https://jsfiddle.net/jshado1/hzy4qvu9/ |
I read #2775 and don't understand what the fix was. I'm still having this issue when using the open prop. When I remove the open prop and allow the popup to control it's own state, the hover is positioned correctly to the rendered container. |
@djnorrisdev If there's a bug, let's open a new issue and we'll tackle it. |
Steps
Expected Result
The popup appears where it normally should.
Actual Result
It appears in the top right corner.
Version
0.63.0
Testcase
http://codepen.io/anon/pen/Mbxmyj
The text was updated successfully, but these errors were encountered: