Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#26385 closed defect (bug) (invalid)

Color picker doesn't display initial colour

Reported by: pkwooster's profile pkwooster Owned by: mattwiebe's profile mattwiebe
Milestone: Priority: normal
Severity: normal Version: 3.5
Component: Customize Keywords: reporter-feedback
Focuses: Cc:

Description

The new iris based admin colour picker does not display the initial colour in the "toggle" box. The colour of the toggle is updated as the cursor is moved but disappears when the page refreshes. The problem is a missing '#' in colour-picker.js near line 34:

--- wp-admin/js/color-picker.js (revision 26486)
+++ wp-admin/js/color-picker.js (working copy)
@@ -31,7 +31,7 @@
                        // Set up HTML structure, hide things
                        el.addClass( 'wp-color-picker' ).hide().wrap( _wrap );
                        self.wrap = el.parent();
-                       self.toggler = $( _before ).insertBefore( el ).css( { backgroundColor: self.initialValue } ).attr( 'title', wpColorPickerL10n.pick ).attr( 'data-current', wpColorPickerL10n.current );
+                       self.toggler = $( _before ).insertBefore( el ).css( { backgroundColor: '#' + self.initialValue } ).attr( 'title', wpColorPickerL10n.pick ).attr( 'data-current', wpColorPickerL10n.current );
                        self.pickerContainer = $( _after ).insertAfter( el );
                        self.button = $( _button );

Change History (8)

#1 @SergeyBiryukov
11 years ago

  • Component changed from Administration to Appearance
  • Version changed from trunk to 3.5

Introduced in [22030].

#2 @SergeyBiryukov
11 years ago

  • Keywords 3.9-early added
  • Milestone changed from Awaiting Review to Future Release

#3 @pkwooster
11 years ago

Hi, thanks for the attention to this. I found a workaround:

            <style>
                .wp-color-result:hover,
                .wp-color-result{
                    background-color:#<?php echo $color ?>;
                }
            </style>

where $color is the current value, before the call to the color-picker.

#4 @nacin
11 years ago

  • Milestone changed from Future Release to 3.9
  • Owner set to mattwiebe
  • Status changed from new to reviewing

#5 @kovshenin
11 years ago

  • Keywords reporter-feedback added

Hi pkwooster! I was not able to reproduce the issue, and looking at your proposed solution, it seems like the initial value you're providing is lacking a #. Have you tried using the full color values (with the #) for the current and the default color values?

It'd be great if you could share the code you're working on, or if you've seen this issue happen in core WordPress let us know the exact steps to reproduce it.

#6 @mattwiebe
11 years ago

  • Resolution set to invalid
  • Status changed from reviewing to closed

Hi pkwooster - it appears that you're initiation the color picker without a leading #, which is currently required to be a valid hex color value. Please provide a rationale for why you need to not supply a full hex value if you think this warrants reopening.

#7 @SergeyBiryukov
11 years ago

  • Milestone 3.9 deleted

#8 @SergeyBiryukov
11 years ago

  • Keywords 3.9-early removed
Note: See TracTickets for help on using tickets.