Skip to content
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 is incorrectly positioned if prop open is set to true on initial render #2381

Closed
fracmak opened this issue Dec 13, 2017 · 5 comments
Closed

Comments

@fracmak
Copy link
Member

fracmak commented Dec 13, 2017

Popup onOpen and onClose handlers aren't getting called correctly on open prop, so it doesn't render properly

Steps

Create popup component with open={true} and a trigger

Expected Result

Expect the popup to render near the trigger

Actual Result

Popup is rendered top right corner of the screen

Version

0.77.1

Testcase

https://codesandbox.io/s/py63r935qq

@brianespinosa
Copy link
Member

@fracmak in your codesandbox example, you have an open prop set on your <Popup> component. Once you do that your popup overrides its internal state and expects you to control the open state yourself externally. If you remove the open` prop, you have defined, your example works as expected.

@fracmak
Copy link
Member Author

fracmak commented Dec 14, 2017

I still think this is a bug, the positioning of the popup isn't correct when you use the prop values to open and close the popup

@brianespinosa
Copy link
Member

@fracmak Playing around with this some more, and digging into the docs, it appears that the open prop is not in the docs as available for <Popup> which I suspect is because of this. This is a bit misleading since there is an example using the prop at the very bottom here: https://react.semantic-ui.com/modules/popup#popup-example-controlled

I looked through the code for Popup to see if there were any notes explicitly not defining it as available on Popup.

@layershifter @levithomason Is there a reason we are not handling this? I have a feeling it might be because the component needs to mount first in order to set the positioning styles on the popup.

@brianespinosa brianespinosa reopened this Dec 14, 2017
@fracmak
Copy link
Member Author

fracmak commented Dec 14, 2017

The use case I've run into is I want to have a close button inside the pop-up so I wanted to control the opening and closing of the pop-up myself but the positioning doesn't work under this one use case and the use case of triggering opening a pop-up without the trigger

@layershifter
Copy link
Member

Duplicate #1065.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants