Closed yahoo0742 closed 3 years ago
I encountered the same issue where the body sizing is not correct for some reason (I'm using the picker inside a page I don't fully control) so I needed to change the container to get the correct bbox. It would be great if the container bbox is used and the body bbox becomes a fallback Thank you
There is a reason for placing popups right on the <body>
element and not in the container of whatever which triggered the popup, because:
overflow:hidden
1
)Many things can go wrong, so placing popups on the document body should work for the vast majority of scenarios.
I do however see edge-cases where one would need to place a popup on a different container, I have encountered myself with such need working on a very large projects where I have interference from CSS if things were places right on the body. I don't remember exactly why, but I do remember the need to place some popups elsewhere.
See Options, you can use container
to specify the parent from pickr. I can't remember the original reason for this but there was an issue about it where body didn't work. @yairEO Also covered a few of the reasons why I didn't pick the button-parent, thank you for that! For anything else the container
option can be used :)
I had a case where the body didn't take the full height of the page and the body bbox was "wrong", that's why the positioning didn't work well for me. Now it's all good, I found a simple fix! (overflow: auto; on html, body)
https://github.com/Simonwep/pickr/blob/3beee11761c165a1ed44084516cdcbc463e8d537/src/js/pickr.js#L507
Hi Simon,
I wonder why you specified the container as "document.body"? One case is that the
or is just a part of the document/window, then the position is unexpected. An example can reproduce the problem is simply changing the body height as 40% or something from the demo you provided https://jsfiddle.net/Simonwep/9ghk71c3/Thanks, Wenbo