simonwep / pickr

🎨 Flat, simple, multi-themed, responsive and hackable Color-Picker library. No dependencies, no jQuery. Compatible with all CSS Frameworks e.g. Bootstrap, Materialize. Supports alpha channel, rgba, hsla, hsva and more!
https://simonwep.github.io/pickr
MIT License
4.31k stars 284 forks source link

color on cancel event when comparison is false #307

Open saeednazarix opened 2 years ago

saeednazarix commented 2 years ago

What is the current behavior?

when comparison: false save button is not needed to set the new color so after any change, the new color is our actual color that has been set but when comparison: false cancel button still doing the same as comparison: true.

Suppose the initial color is red when we don't use comparison: false (default mode) we change color in color picker to black then white then yellow then brown without clicking on the save button so if we click on the cancel button we get our initial color (red) and because we didn't click on save it ignores all the changes we have made. but in comparison: false again suppose the initial color is red, then we change color in color picker to black (now black get's set as our actual color), then we change color to white (now white get's set as our actual color) so meantime click on the cancel button and you would see it revert color to initial color (red) and ignores all of our color choices.

also, one of the preview bars (left bar in classic theme or top bar on monolith theme) sections won't update on selecting new colors.

Please provide the steps to reproduce and create a JSFiddle.

What is the expected behavior?

when we use comparison: false the cancel button should give us the color that we choose before the current color. suppose the initial color is "A", we changed that color to "B" (now "B" is our actual color, then we changed that color to "C" so if we click on the cancel button now it would give us the color "B" (the previous actual color before current color) so It should not give us the color "A" (initial color). it ignores our color choices. because we don't use the save button in comparison: false so each color we choose is our new actual color so the picker should not ignore our choices. also, the preview bar should be doing the same thing as above.

just to mention when I said 'actual color', it is the color that is set as the main color (like the color when we click on the save button).

Your environment:

Version (see Pickr.version): latest - 1.8.2
Used bundle (es5 or normal one): both
Used theme (default is classic): all themes
Browser-version:  chrome 96 / firefox 94 / safari 15
Operating-system:  macOS Monterey 12.0.1