simonwep / simonwep/pickr

color on cancel event when comparison is false

Open
#307 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

unconfirmed
Dominant language
JavaScript
Stars
4.5k
Forks
292
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with comparison: false using the linked JSFiddle, then trace the cancel-button event handling and the preview-bar update behavior across the themes. Done means cancel restores the color chosen immediately before the current color and the affected preview bar stays synchronized.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.