Make WordPress Core

Opened 8 years ago

Last modified 17 months ago

#36512 new defect (bug)

Color picker has disappeared from input in custom post type.

Reported by: anou's profile anou Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5
Component: Administration Keywords: reporter-feedback
Focuses: ui, javascript Cc:

Description

In a custom plugin I've created some metaboxes with color picker fields.
Here how I call the color picker style :

add_action( 'admin_enqueue_scripts', 'le_chiffre_add_color_picker' );
function le_chiffre_add_color_picker( $hook ) {
  // $hook to apply a check for admin page.
  wp_enqueue_style( 'wp-color-picker' );  
 
  wp_enqueue_script( 'custom-script-handle', plugins_url( 'custom-script.js', __FILE__ ), array( 'wp-color-picker' ), false, true ); 
}

the HTML input (created dynamically):

<input class="color-field" placeholder="#FFCC00" id="_chiffre_bgcolor" name="_chiffre_bgcolor" value="#c61d4c" size="" type="text">

and the js for my input fields, loading the color picker:

(function( $ ) {
 
    // Add Color Picker to all inputs that have 'color-field' class
    $(function() {
        $('.color-field').each(function(){
          $(this).wpColorPicker();
        });
    });
     
})( jQuery );

With WordPress 4.4.2 everything worked like a charm (I even did a reverse from 4.5 to 4.4.2 to be sure of it) and now with the 4.5 version, the color picker doesn't show up on my fields...

I didn't found anybody having the same issue.

Have a nice day
David THOMAS

Change History (4)

#1 @anou
8 years ago

After some testing seems to be a more general javascript bug. the "modify" permalink on post edit form doesn't work and the "add media" either ...

Reverting to 4.4.2 is my only solution for now.

#2 @DrewAPicture
8 years ago

  • Component changed from General to Administration

This ticket was mentioned in Slack in #core by peterwilsoncc. View the logs.


3 years ago

#4 @desrosj
17 months ago

  • Keywords reporter-feedback added

@anou Apologies that this took so long to receive a response!

I've tried to reproduce this issue, but I'm not sure I have enough information. Since it's been 6+ years and there don't seem to be similar reports, I'm thinking it may have been an issue the implementation.

I'm also fairly certain that Gutenberg does not rely on the same colorpicker script. With this in mind, I'm going to close this one out, but if you're still able to reproduce this on the most recent version of WordPress (currently 6.0), feel free to reopen with more details.

Note: See TracTickets for help on using tickets.