[wp-trac] [WordPress Trac] #25809: wpColorPicker Shows Twice When First Added to Sidebar

WordPress Trac noreply at wordpress.org
Sun Nov 3 17:38:32 UTC 2013


#25809: wpColorPicker Shows Twice When First Added to Sidebar
--------------------------+-----------------------------
 Reporter:  BookWookie    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Widgets       |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 When using the {{{wpColorPicker}}} in a widget, the first time the Widget
 is added to the sidebar, the color picker shows twice. Only one of the
 pickers is functional. After saving, only one color picker is shown and
 everything is fine.

 I found a similar ticket here -
 http://core.trac.wordpress.org/ticket/23293. That ticket was marked as
 invalid, but I think this issue needs to be revisited, as the documented
 solution does not work.

 Here's the code I've tried adding inside of the widget's {{{form}}}
 function and the corresponding results:
 {{{
 <script>
     jQuery(document).ready(function($) {
         $(document).ajaxComplete(function() {
             $('.color-picker').wpColorPicker();
         });
     });
 </script>
 }}}
 The above shows two color pickers in the widget's settings, only one of
 which is functional.
 [[BR]]
 {{{
 <script>
     jQuery(document).ready(function($) {
         $('.color-picker').wpColorPicker();
     });
 </script>
 }}}
 The above shows two color pickers in the widget's settings, only one of
 which is functional.
 [[BR]]
 {{{
 <script>
     jQuery(document).ready(function($) {
         jQuery("#widgets-right .widgets-sortables").on("sortstop",
 function(event, ui) {
             jQuery(".color-picker").wpColorPicker();
         });
     });
 </script>
 }}}
 The above shows two color pickers in the widget's settings, none of which
 work.

 I've tried downloading third party plugins to see how they do it, and they
 suffer from the same duplicate color picker issue.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25809>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list