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: doesn't reposition when changing its context #3478

Closed
Wyverex42 opened this issue Mar 7, 2019 · 3 comments · Fixed by #3532
Closed

Popup: doesn't reposition when changing its context #3478

Wyverex42 opened this issue Mar 7, 2019 · 3 comments · Fixed by #3532
Assignees
Labels

Comments

@Wyverex42
Copy link

Wyverex42 commented Mar 7, 2019

Bug Report

I have a shared Popup that is meant to be used as a tooltip. I explicitly don't want to have a Popup associated with all items on my page that can have a tooltip because this creates a LOT of popups and hurts performance.
So my solution is to use global state via /~https://github.com/diegohaz/constate to share the ref of the DOM node where the Popup should be opened.
Sadly, positioning the popup via the context property doesn't work correctly in my use case.

Steps

  • Open https://codesandbox.io/s/vmm391vpv7
  • Open the main popup
  • Hover over any item
  • A tooltip opens
  • Hover over another item next to the first one
  • The tooltip doesn't move
  • Move the mouse to the border of the main popup so that the main popup stays open but the tooltip closes
  • Hover over another item in a different row or column
  • The popup opens in a new position

Expected Result

  • When closing a popup and reassigning its context, the popup should be positioned at the updated context when it's opened the next time.
  • The popup should point to the correct corner of its context

Actual Result

  • The popup doesn't move when being reopened. It only moves if it completely disappeared first.
  • The popup doesn't point to the correct corner of its context DOM element

I suspect I could make it work if I could somehow wait until the popup is completely gone until reopening it again. I've tried several combinations of state logic but none has worked for me so far.
Even then it will probably still have issues with pointing at the correct corner.

Version

0.85.0

Testcase

https://codesandbox.io/s/vmm391vpv7

@layershifter
Copy link
Member

layershifter commented Mar 7, 2019

Sorry, but we don't have time to debug your code. It looks crazy and I'm completely lost in it 🦏
Can you please reopen issue with a minimal repro or update existing?

@Wyverex42
Copy link
Author

Wyverex42 commented Mar 7, 2019

Ok, I've now spent close to another two hours trying to compress this example even more. Luckily I could get rid of constate and the hack. Also, you don't even need to nest the popup. This is as short as it gets:
https://codesandbox.io/s/q83oky26xq

The issues are still visible.

I can't reopen the issue though since you already closed it and I'm no collaborator.

@Wyverex42 Wyverex42 changed the title Popup nested in scrollable popup doesn't reposition when changing its context Nested popup doesn't reposition when changing its context Mar 7, 2019
@Wyverex42 Wyverex42 changed the title Nested popup doesn't reposition when changing its context Popup doesn't reposition when changing its context Mar 8, 2019
@layershifter layershifter reopened this Mar 8, 2019
@layershifter
Copy link
Member

Now it's clear to me, will try to find the root issue.

@layershifter layershifter changed the title Popup doesn't reposition when changing its context Popup: doesn't reposition when changing its context Mar 25, 2019
@layershifter layershifter self-assigned this Mar 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants