mdbassit / Coloris

A lightweight and elegant JavaScript color picker. Written in vanilla ES6, no dependencies. Accessible.
https://coloris.js.org/examples.html
MIT License
471 stars 58 forks source link

Multiple color pickers swatches problem #38

Closed Stibo closed 2 years ago

Stibo commented 2 years ago

Hi

First of all, awesome color picker. I love the simplicity of it. We have multiple color pickers on one page with different configurations. That works almost perfect, but we found a tiny little bug. If we select a color picker that uses swatches and then switch to another color picker without swatches, then the swatches from the previously added are displayed. I digged into the code and found the error:

On line 103 (coloris.js) theres a condition that only replaces the html if there are swatches defined (if (swatches.length)). You should add an else statement that sets the innerHTML to an empty string or something like this.

mdbassit commented 2 years ago

Thank you for the kind word and the bug report! Indeed, it's an oversight on my part, I will release a fix today.

Stibo commented 2 years ago

Thanks for the quick fix. Amazing support!

melloware commented 2 years ago

I have updated NPM with the fixes and released 0.10.3 as well.