Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#41623 closed defect (bug) (fixed)

Wide widgets in Customizer fail set max-height on wrong container for Text and Media widgets

Reported by: westonruter's profile westonruter Owned by: westonruter's profile westonruter
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.8
Component: Customize Keywords: has-patch has-screenshots
Focuses: Cc:

Description

The Text widget and Media widgets put their controls outside of the .widget-content element since it gets replaced with fields from the server with each save, and since these widgets have JS-managed fields this eliminates the need to re-initialize the fields (with a flicker) every time the widget is saved.

For “wide widgets” in the Customizer, the widget is positioned in a way that it can be floated over the preview for more room. However, the Text and Media widgets when extended (and wide) will currently appear too tall because the max-height is still set on .widget-content when instead it needs to be set on the parent .form element.

Easy way to reproduce the problem is to add an mu-plugin with the following:

<?php
require_once ABSPATH . '/wp-includes/widgets/class-wp-widget-text.php';

class Extended_Text_Widget extends WP_Widget_Text {
        function __construct() {
                parent::__construct();
                $this->id_base = 'extended_text';
                $this->name = __( 'Extended Text' );
                $this->option_name = 'widget_' . $this->id_base;
                $this->widget_options['description'] = __( 'Extended arbitrary text.' );
                $this->control_options['id_base'] = $this->id_base;
        }
}
add_action( 'widgets_init', function() {
        register_widget( 'Extended_Text_Widget' );
} );

If you add this widget in the Customizer, you'll see it takes up the entire vertical space instead of just the space needed for the editor.

Attachments (2)

41623.0.diff (540 bytes) - added by westonruter 6 years ago.
wide-text-widget-fixed.png (124.4 KB) - added by westonruter 6 years ago.

Download all attachments as: .zip

Change History (4)

@westonruter
6 years ago

#1 @westonruter
6 years ago

  • Keywords has-patch has-screenshots added

#2 @westonruter
6 years ago

  • Owner set to westonruter
  • Resolution set to fixed
  • Status changed from new to closed

In 41246:

Customize: Update selector to add max-height/max-width for wide widgets to account for JS-driven Text widget and Media widgets.

Fixes #41623.

Note: See TracTickets for help on using tickets.