[wp-trac] [WordPress Trac] #45314: Links widget breaks live preview in customizer

WordPress Trac noreply at wordpress.org
Thu Nov 8 19:01:16 UTC 2018


#45314: Links widget breaks live preview in customizer
---------------------------+-----------------------------
 Reporter:  angelocarosio  |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Widgets        |    Version:
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 I saw a few other tickets on this from a while ago but it doesn't seem
 like an actual fix has ever made it into core. I did some digging on this
 to maybe point in the right direction, there are basically 2 issues:

 1. The regex on line 51 of class-wp-widget-links.php is replacing the live
 preview IDs that are injected into the widget containers inside the
 customizer. As it currently is, adding any links widget breaks the edit
 shortcuts and live preview ability for all other widgets in the widget
 area.


 2. While I was able to basically fix #1 by filtering some widget args,
 there is still another issue. When the widget is set to show multiple
 categories, each category gets its own widget container markup (line 56
 and 57). This breaks the 1:1 relationship between the widget and its
 container that the customizer is expecting, so even if #1 is fixed,
 changing options around causes multiple copies of the widget to be
 inserted inside the customizer. Wrapping everything in an additional div
 and giving that the widget markup seems to fix this problem, but that's
 obviously not a fix I can make.

 Turning off 'customize_selective_refresh' => true, in the widget options
 obviously also fixes this, and I think most people would be happier with a
 working links widget even if selective refresh isn't supported,
 considering this is technically a depreciated feature.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45314>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list