everweij / react-laag

Hooks to build things like tooltips, dropdown menu's and popovers in React
https://www.react-laag.com
MIT License
906 stars 44 forks source link

Make repositioning less glitchy #61

Open rijk opened 3 years ago

rijk commented 3 years ago

Here's a screen capture of what I mean:

https://user-images.githubusercontent.com/159500/105332099-86eff800-5bd4-11eb-963b-618ae73cced5.mov

There's a 1 frame glitch where the tooltip grows and is then repositioned:

image

This looks bad. Ideas for improvement:

rijk commented 3 years ago

Be smarter how to position the layer. In this case, use bottom instead of top.

Popper JS does this BTW: https://popper.js.org/docs/v2/modifiers/compute-styles/#adaptive

Add an option to disable repositioning after initial positioning

I also enjoy the way Popper gives you more control over this (with an update() function you can call when you see fit). But it might not fit your vision for this library.