Colorpicker issues with webkit
We were recently contacted by a Qhub creator about a problem he was having with our “Page Design” control in Safari 5 and other webkit browsers. After some debugging I found that webkit browsers were not allowing submission of the form due to a problem with the colorpicker plugin we use.
This was the error we were seeing in the console:
"An invalid form control with name='' is not focusable."
Not extremely helpful but I persevered. After digging into this error more I noticed it all boiled down to the HSB values that were being submitted when changing the hex value. When a hex value was set, RGB and HSB are set according to the hex value, but all the inputs in the colorpicker plugin have a maxlength of 3. One of the values being set for HSB was a decimal (e.g. 68.45641) longer than 3 characters. This then caused webkit browsers to prevent the form being submitted and throw the previously mentioned error in the console. So to correct this problem when the fillHSBFields function set the value of the HSB input fields we performed parseInt first.
The fix we applied needs you to edit 3 lines within the fillHSBFields function.
Change
.eq(4).val(hsb.h).end() .eq(5).val(hsb.s).end() .eq(6).val(hsb.b).end();
To
.eq(4).val(parseInt(hsb.h,10)).end() .eq(5).val(parseInt(hsb.s,10)).end() .eq(6).val(parseInt(hsb.b,10)).end();
Thanks to @ciaravino for spotting the error in the first place!
