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

usePopper: changes in strategy puts the popper in a incorrect position #381

Open
dfernandez-asapp opened this issue Jul 29, 2020 · 1 comment

Comments

@dfernandez-asapp
Copy link
Contributor

Reproduction demo

https://codesandbox.io/s/condescending-mendel-bo6hp?file=/src/App.tsx

Steps to reproduce the problem

  1. Pass a strategy value to usePopper that depends on a property or state
  2. Switch the strategy value from 'fixed' to 'absolute' and viceversa
  3. Now the popper is incorrectly positioned, even if you go back to the previous strategy value.

What is the expected behavior?

Changes in strategy should keep the popper visually positioned in the same place.

What went wrong?

The changes in strategy are not correctly reflected.

Any other comments?

I think that a possible cause of this bug may be here:
https://github.com/popperjs/react-popper/blob/master/src/usePopper.js#L117

Because popperOptions is not one of the effect dependencies.

Packages versions

  • Popper.js: 2.4.4
  • react-popper: 2.2.3
@dfernandez-asapp
Copy link
Contributor Author

About my comment on the possible cause. That's not the issue, there is another effect a few lines up that does a setOptions. I checked with the debugger and the options are updated, but for some reason the positioning is wrong after an strategy update.

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

No branches or pull requests

1 participant