Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant