Opened 9 years ago
Closed 9 years ago
#33396 closed defect (bug) (fixed)
Customizer: focusing a control outside of a panel when a panel is open results in a blank screen with no navigation back
Reported by: | celloexpressions | Owned by: | westonruter |
---|---|---|---|
Milestone: | 4.3.1 | Priority: | normal |
Severity: | major | Version: | 4.3 |
Component: | Customize | Keywords: | has-patch commit fixed-major |
Focuses: | javascript | Cc: |
Description
When focusing a control in JS, ex. with something like:
wp.customize.control('site_icon').focus();
If a panel happens to be open (say, we're in widgets or menus somewhere and a context change to site icon is triggered by an interaction in the controls or the preview), and the newly-focused control is not nested within a panel, the Customizer controls become hidden off screen with no way to get them back without reloading.
This seems to be somewhat of an issue in 4.2 also, but navigation to get back was accessible. Now, there is no way for a user to recover from the results of this interaction. Reasonably simple fix in the attached patch (exact placement/approach could be adjusted, but this seems to be what we need and didn't break anything else in quick testing).
We would run into this with the shift-click widget focusing, but it steps around it since those controls are within a panel.
Attachments (3)
Change History (13)
#4
@
9 years ago
This is related to a workaround I had to put in place for the WP_Nav_Menu_Widget
to deep link to the menus panel from a given nav menu widget:
<?php if ( isset( $GLOBALS['wp_customize'] ) && $GLOBALS['wp_customize'] instanceof WP_Customize_Manager ) { // @todo When expanding a panel, the JS should be smart enough to collapse any existing panels and sections. $url = 'javascript: wp.customize.section.each(function( section ){ section.collapse(); }); wp.customize.panel( "nav_menus" ).focus();'; } else { $url = admin_url( 'nav-menus.php' ); } ?> <?php echo sprintf( __( 'No menus have been created yet. <a href="%s">Create some</a>.' ), esc_attr( $url ) ); ?>
#5
@
9 years ago
- Keywords needs-testing added
- Owner set to westonruter
- Status changed from new to accepted
Per my issue above, the problem of the blank screen was still happening if a section within a panel was open. So for instance, if I went to edit a widget and I opened the console and ran:
wp.customize.panel( 'nav_menus' ).focus();
Then I would get the same blank screen behavior, and this is why I put in that WP_Nav_Menu_Widget
workaround.
In the latest patch I believe I've addressed this one as well, which now means that my workaround in the WP_Nav_Menu_Widget
can also be removed. See amended patch 33396.2.diff.
@celloexpressions Can you confirm?
Moving to 4.3 for tracking; it's late but a small change so it could probably get in. If not, we definitely need to get it into 4.3.1.