floating-ui / react-popper

🍿⚛Official React library to use Popper, the positioning library
https://popper.js.org/react-popper/
MIT License
2.5k stars 226 forks source link

Arrow position does not follow after flipping the tooltip when using a VirtualElement as reference #456

Open CJourneaux opened 1 year ago

CJourneaux commented 1 year ago

Reproduction demo

Code sandbox link

There are instructions on how to use the demo, and how to reproduce the bug step-by-step in the demo.

Steps to reproduce the problem

  1. Create a virtual element that will be the reference point for positioning the tooltip
  2. Create a tooltip with :
    • a placement "top"
    • an offset big enough to position an arrow inside
    • a reference to an arrow element
  3. Place the virtual element so that the tooltip would collide with the borders if placed above the reference
    • the tooltip will flip to place under the virtual element
    • the arrow should place itself above the tooltip but remains under

Alternative that causes the same bug

  1. Follow the same procedure as above, but use a placement "left" this time
  2. The arrow never positions itself properly between the tooltip and the virtual element, whether the tooltip has flipped or not

What is the expected behaviour?

What went wrong?

Any other comments?

Not sure whether this bug is caused by :

Packages versions