Semantic-ui-react: Popup: position not kept if trigger element changes

Created on 15 Mar 2019  路  7Comments  路  Source: Semantic-Org/Semantic-UI-React

Bug Report

Steps

1 - Render a popup with a button (better if inside a custom component)
2 - Set the onOpen handler to simulate the button onClick or directly onClick to add a label to that button (managing this.setState for example, hence the custom component)
3 - Click the button in order to add a label to it
4 - Close the popup (by making any other action)
5 - Open the popup again, it should be located in the upper left corner of the screen (top: 0, left: 0)

Expected Result

The expected result was to see the Popup under or around the Trigger element

Actual Result

Actual result: 2nd render of popup is on coordinates 0,0

Version

v0.83.0

Testcase

https://codesandbox.io/s/62m4v7j13w

Guesses

I've taken a peek at the <Portal> element controlling the popup behaviour, as well as the <RefXXX> elements. Sadly I don't have the time to investigate further, but I'm guessing that since the trigger element is re-rendered somewhere along the line the reference is lost, and thus the calculated positions are (0,0)

bug

Most helpful comment

I'm going to finish with it before 1 Apr, after it will be done I will push Levi to release it :)

All 7 comments

馃憢 Thanks for opening your first issue here! If you're reporting a 馃悶 bug, please make sure you've completed all the fields in the issue template so we can best help.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

We will switch to react-popper soon, it will resolve a ton of positioning issues.

@layershifter thanks for the quick answer!
Do you happen to have a timeline for this switch ?

Thanks a lot for your work/time!

I'm going to finish with it before 1 Apr, after it will be done I will push Levi to release it :)

@layershifter great news! Thanks again!
Should i close the issue then, or can we close it now?

It will be closed automatically 馃樅

Loving it!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

saikrishnadeep picture saikrishnadeep  路  3Comments

SajagTiwari picture SajagTiwari  路  3Comments

AlvMF1 picture AlvMF1  路  3Comments

jayphelps picture jayphelps  路  3Comments

levithomason picture levithomason  路  3Comments