pickr icon indicating copy to clipboard operation
pickr copied to clipboard

Fix hidden pickr instances issues

Open DEfusion opened this issue 4 years ago • 2 comments

If the container the pickr is output in is not visible when it is created the position of the movable handles is not shown correctly on opening, this then has the knock-on effect of not setting the color correctly on interaction unless you click on the palette or a swatch first.

This change addresses that by ensuring the color is set on the first call to show after the picker is made visible, this also reverts the changes from 0d445e57.

Fixes #226

DEfusion avatar Jul 07 '20 13:07 DEfusion

Hmm, I wonder if we could just move the entire initialization code to when show gets called the first time. I'm not sure how that would react to different environments though...

I'm also not certain about this as the default color-value is more or less ignored, what if show get's called first (the parent is still invisible) but the default color hasn't been assigned yet 🤔

simonwep avatar Jul 13 '20 18:07 simonwep

Yeah I'm not sure if moving everything to show would work for every use case as not as familiar with other uses than our use case, it would be nice to get rid of the infinitely running callback waiting for the picker to visible.

I was wondering about whether the moveables could/should detect that they're not visible and have those handle it somehow because it's there that things break down on the initial update calls.

I can certainly amend this PR to try and move initialization to show or any other ideas, I was worried about the init event not being triggered that may cause problems but that also won't be triggered right now until it's visible anyway...

DEfusion avatar Jul 15 '20 12:07 DEfusion