colorpicker icon indicating copy to clipboard operation
colorpicker copied to clipboard

Active color does not set in Chrome

Open JerrodV opened this issue 9 years ago • 4 comments

This only happens in Chrome (48.0.2564.109 m)

If I use setColor() to set a color into the color picker, then open the color picker by clicking the button, the selected color is always black and not the value the button shows. A cancel click then sets black to the colorpicker despite it not being the last color set and a color that has never been set to the colorpicker. My colorpicker version is 1.1.8.

JerrodV avatar Feb 16 '16 16:02 JerrodV

I was able to correct this issue by making a minor alteration to the library. It seems to work well for my use case, but I'd hope this would be properly evaluated by a team member before considering introducing the fix, since I am not sure what else it might effect. Note that in my case I am not using the colorpicker in in-line mode.

I've altered line (approx.) 2441 from: that._setColor(that.inline || !that.element.is('input') ? that.options.color : that.element.val());

to: that._setColor(!that.inline ? that.options.color : that.element.val());

This now sets the 'ui-colorpicker-map-pointer' to the proper color when the dialog is opened in IE(11.0.9600.18124), Chrome(48.0.2564.109 m) and FF(44.0.1). I will be testing this in Safari tomorrow and will post the results back here.

Also, if you for see this causing me any problems, I'd appreciate the heads up. I have not seen anything in my testing, but I'd rather be safe than sorry.

Thanks for a great widget.

JerrodV avatar Feb 17 '16 22:02 JerrodV

Thanks for the report and possible fix. I'll look in to this issue. It's weird that it would only show up in Chrome.

I can't seem to reproduce the issue with JSFiddle (http://jsfiddle.net/gt2hqsx0/3/) using Chrome 48.0.2564.109 m. Could you please take a look at the JSFiddle and tell me what I need to do in order to reproduce it?

vanderlee avatar Feb 18 '16 10:02 vanderlee

Can you tell me if you're using the colorpicker inline or as a popup dialog?

vanderlee avatar Feb 23 '16 21:02 vanderlee

If I understand the question correctly, the colorpicker is being used in popup mode. The user clicks a button and the color swatches are then chosen from a dialog. I have attached a couple images that hopefully better describe my use case. On the left (of image1) I have a canvas and on the right, settings that apply to the objects in the canvas. When I select the object, I needed to set the current color of the object to the colorpicker, which shows correctly in the button. However, as in the second image, When the colorpicker opened, the selected color was always black. Keep in mind I just set the second image that way as my workaround seems to be holding up.

I looked at the fiddle, and the issue I'm seeing does not appear to be happening there. However, I am using a different call to set the color:'colorpicker.setColor(color);'. I will try to find some time to see if I can repro the issue for you and then I'll get back to you. Thanks for taking interest.

image1 image2

JerrodV avatar Sep 21 '16 18:09 JerrodV