day8 / re-com

A ClojureScript library of reusable components for Reagent
https://re-com.day8.com.au
MIT License
796 stars 147 forks source link

Dropdown menu cutoff by scroller #221

Open polvoblanco opened 3 years ago

polvoblanco commented 3 years ago

Hi,

Does anyone know a way to prevent the popup (menu) portion of the single-dropdown from being cut off when used inside a scroller?

Thanks, Paul

Gregg8 commented 3 years ago

While we went to lengths to make the popover component expand beyond the limits of scrollers (using the :no-clip? arg, see: http://localhost:3449/#/popovers), this was not extended to any other component. It also had the disadvantage in that when you scrolled while the popover was visible, the popover remained fixed on screen while the anchor scrolled away with the window.

So not a perfect solution.

If you're interested in implementing the same functionality for the dropdown, then here is the black magic that does it:

The trick used it to set the :position of the popover div to "fixed" and then calculate where it should be on screen under fixed positioning.

Furthermore, if you get it working (using this or a better technique), we'd appreciate a PR.