alexkatz / react-tiny-popover

A simple and highly customizable popover react higher order component with no other dependencies! Typescript friendly.
MIT License
454 stars 121 forks source link

Popover renders in the wrong position when the target is offscreen. #41

Closed dmitrif closed 3 years ago

dmitrif commented 5 years ago

Issue When repositioning is true, the nudged position is calculated incorrectly for when the target is scrolled off screen.

Current wrong

Desired right

This is happening due to the nudgePosition function discarding the calculated top position, when it is less than the windowPadding value.

PR incoming.

bengry commented 5 years ago

@dmitrif did you end up fixing the issue mentioned here?

dmitrif commented 5 years ago

@bengry No, ended up switching to react-popover as the investment to rewrite the positioning logic here was a bit too high to fit into my timebox.

alexkatz commented 3 years ago

Hi all, I've recently released version 6 of react-tiny-popover, which is a completely functional and hooks-based overhaul. The above issue is no longer present, as the API of react-tiny-popover now allows users to specify a containerParent whose boundaries are to be adhered to, rather than always defaulting to window.

This makes the following behavior possible:

popover-demo

I'll close this for now, and apologies for not replying sooner!