Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swatch isn't selected when minicolors inits and input has a swatch color value #256

Open
pjfsilva opened this issue Aug 16, 2018 · 1 comment

Comments

@pjfsilva
Copy link

Steps to reproduce:

On an input field with a value of a color of a swatch, init the minicolors plugin. If you open minicolors you can see the swatch color isn't selected (if you type another value it is then selected)

This happens because on init updateFromInput is called and that doesn't do the logic of selecting the swatch instead it calls doChange but only when minicolors is initialized:

// Fire change event, but only if minicolors is fully initialized
    if(input.data('minicolors-initialized')) {
      doChange(input, value, opacity);
    }

I'm not sure why doChange isn't called always, if it's just for performance issue or if it's to fix some bugs but I see 2 possible solutions: add swatch selection logic to init or updateFromInput or always call doChange even if minicolors is initialiazing.

@claviska claviska added the Bug label Aug 16, 2018
@claviska
Copy link
Owner

Good catch. doChange() will trigger a change event, so it's probably best to set this on init.

Care to submit a PR? 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants