[wp-trac] [WordPress Trac] #30031: Changing a ColorControl's setting via JS fails to update control's state
WordPress Trac
noreply at wordpress.org
Sat Oct 18 17:16:55 UTC 2014
#30031: Changing a ColorControl's setting via JS fails to update control's state
--------------------------+-----------------
Reporter: westonruter | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.1
Component: Customize | Version: 3.4
Severity: normal | Keywords:
Focuses: javascript |
--------------------------+-----------------
In Twenty Fifteen, the `colorScheme` control has to dynamically change
other Customizer settings for the colors based on which scheme is
selected. It currently has to manually interact with the Customizer
controls for these settings because changes to the underlying model is not
resulting in an update to the color picker UI:
{{{
#!js
var parentSection = this.container.closest( '.control-section' ),
backgroundColor = parentSection.find( '#customize-control-
background_color .color-picker-hex' );
// ...
backgroundColor.val( colorScheme[value].colors[0] )
backgroundColor.wpColorPicker( 'color', colorScheme[value].colors[0] )
}}}
Likewise, if you open any instance of Customizer for any theme that has a
background color, find the background color control and then enter these
commands in the JS console one by one:
{{{
wp.customize('background_color').set( '#000000' )
wp.customize('background_color').set( '#999999' )
wp.customize('background_color').set( '#FFFFFF' )
}}}
You'll notice that the Customizer preview gets updated with the background
color, but the controls do not. The `ColorControl` needs to be fixed to
automatically update the color picker state when the setting changes.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30031>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list