Open sidewayss opened 1 week ago
It looks like we have this issue because some of the slider's color stops have the value lab(NaN% NaN NaN)
. This definitely should not happen.
Actually, we have a FIXME comment from Lea there: https://github.com/color-js/elements/blob/24ac3f7a67178f0b4cd5bc5da8b1bb3562e316fe/src/color-slider/color-slider.js#L74
@LeaVerou, could you please elaborate a bit on what should happen with such colors?
Is this simply a case of null
needing to be converted to zero? CSS none
is null
in Color.js, and parseFloat()
converts null
to NaN
. Excuse me if I'm way off base here, this code goes on to do a lot that I don't understand.
btw - It looks like you just changed the way you display the numeric inputs that display above the sliders. It's an improvement, but you should consider using my <input-num>
element :-) I'd obviously love to see it used, but it really is a huge set of improvements over <input type="number">
, which is widely disparaged, and with good reason. There's a test/demo app here, so you can put it through its paces: https://sidewayss.github.io/html-elements/apps/input-num/
I should have an NPM package ready later this week, along with a dist/
directory for bundled files, if you need one of those. For now you can link directly to:
https://sidewayss.github.io/html-elements/input-num.js
To my surprise, the most novel thing about <input-num>
and the other elements in that repo is that I haven't seen other examples of externalizing the templates and letting the user configure the path to the template file(s). It does offer great graphic control.
null
should not usually be converted to 0
, that's a last ditch effort. If we're interpolating, null
should be converted to the corresponding value in the previous/next stop (adding two stops if these are different).
In your docs page: https://elements.colorjs.io/src/color-picker/#dynamic