Opened 10 years ago
Closed 8 years ago
#30964 closed defect (bug) (maybelater)
Color picker doesn't handles empty values from javascript correctly
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.1 |
Component: | Customize | Keywords: | reporter-feedback has-patch |
Focuses: | javascript | Cc: |
Description
I have one template which is highly customizable and I created "subtemplates" from that by javascript using the wp.customize api. (more detail: #30951)
If I set empty for color in one subtemplate and I changed from a subtemplate which had this color set, then the color value is empty, but the color box, beside the input is colored.
api.instance('background_color').set('');
<- I mean that for empty
I attached an image about this.
- Left to the "Current Color" text, the box is colored, (not correct behaviour)
- but no hexa value is added. (correct behaviour)
Attachments (2)
Change History (7)
#1
@
10 years ago
- Keywords reporter-feedback added
- Milestone changed from Awaiting Review to Future Release
#2
@
8 years ago
- Keywords has-patch added
wpColorPicker
contains some logic that could handle this situation. One of them is to trigger a change
event on the colorpicker's element
, which is the approach in 30964.diff.
Alternatively, the background color could be set manually, or a separate function could be added to ColorPicker
for clearing the color and firing callbacks.
Currently the
ColorControl
is doing this when the setting changes:From looking the
wpColorPicker
JS, I think we are missing something. It looks like maybe what needs to happen is this:It looks like maybe the Iris library doesn't support a UI with an unset value.
Please try it out, and see if this is the answer.