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

fix: arrow not positioned properly at initialisation #393 #394

Closed skimi closed 3 years ago

skimi commented 3 years ago

See #393 for description

I'll see about adding a test as soon as I can. Until then anyone having this issue can just add the "position: absolute" to the arrow via their own styling

FezVrasta commented 3 years ago

Thanks! I'll wait for the test and then I'll merge it.

skimi commented 3 years ago

@FezVrasta I've added a very basic test

I would have liked to actually check that the arrow is centered at initialization by checking the transform value returned by popperjs but did not manage it. All positioning within jest are at 0 since there is no actual dom to do anything different. I tried mocking all the usual suspect like getBoundingClientRect, offsetWidth and offsetHeight but it wasn't enough 😞

Anyhow since it was too complex and knowing the real tool for this would be Cypress or puppeteer I kept it simple

FezVrasta commented 3 years ago

Thanks!