[wp-trac] [WordPress Trac] #40189: Changeset #39379 fix does not work with extensions
WordPress Trac
noreply at wordpress.org
Fri Mar 17 16:44:25 UTC 2017
#40189: Changeset #39379 fix does not work with extensions
--------------------------+-----------------------------
Reporter: goth69 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version: 4.7.3
Severity: normal | Keywords:
Focuses: javascript |
--------------------------+-----------------------------
The original ticket is #38952.
If I use a plugin (e.g. WooCommerce), which is adding a meta box next to
the advanced menu properties, the ability to show and hide menu property
fields will be broken again.
WooCommerce adds its endpoint meta box this way:
{{{#!php
add_meta_box( 'woocommerce_endpoints_nav_link', __( 'WooCommerce
Endpoints', 'woocommerce' ), array( $this, 'nav_menu_links' ), 'nav-
menus', 'side', 'low' );
}}}
After the rendering the first meta box with HTML class "metabox-prefs"
will be the WooCommerce Metabox and then comes the WordPress meta box with
the toggles. Because of this, the fix will be broken.
The broken code is located at line '940' in the javascript file
(customize-nav-menus.js).
{{{#!js
fieldActiveToggles = api.panel( 'nav_menus' ).contentContainer.find(
'.metabox-prefs:first' ).find( '.hide-column-tog' );
}}}
The selector '.metabox-prefs:first' is wrong in this case, because we
cannot rely on the position of a metabox in an extensible container. The
'fieldActiveToggles' variable will be empty, because the WooCommerce meta
box has no element with class 'hide-column-tog'.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40189>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list