Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#31330 closed defect (bug) (fixed)

Customizer Controls with a `type` of `hidden` receive a margin

Reported by: dlh's profile dlh Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.2
Component: Customize Keywords: has-patch
Focuses: ui Cc:

Description

WP_Customize_Controls with a type of hidden receive a margin-bottom: 8px, creating a slight gap when they are next to visible controls.

The attached patch removes the bottom margin on .customize-control-hidden.

Example code and screenshots:

function demo_customize_hidden( $wp_customize ) {
        $wp_customize->add_section( 'demo_section', array(
                'title'    => 'Example Section',
                'priority' => 10,
        ) );

        $wp_customize->add_setting( 'demo_first_text_setting' );
        $wp_customize->add_setting( 'demo_second_text_setting' );
        $wp_customize->add_setting( 'demo_hidden_setting' );
        $wp_customize->add_setting( 'demo_third_text_setting' );

        $wp_customize->add_control( 'demo_first_text_control', array(
                'label'    => 'Demo First Text Setting',
                'section'  => 'demo_section',
                'settings' => 'demo_first_text_setting',
                'type'     => 'text',
        ) );
        $wp_customize->add_control( 'demo_second_text_control', array(
                'label'    => 'Demo Second Text Setting',
                'section'  => 'demo_section',
                'settings' => 'demo_second_text_setting',
                'type'     => 'text',
        ) );
        $wp_customize->add_control( 'demo_hidden_control', array(
                'section'  => 'demo_section',
                'settings' => 'demo_hidden_setting',
                'type'     => 'hidden',
        ) );
        $wp_customize->add_control( 'demo_third_text_control', array(
                'label'    => 'Demo Third Text Setting',
                'section'  => 'demo_section',
                'settings' => 'demo_third_text_setting',
                'type'     => 'text',
        ) );
}
add_action( 'customize_register', 'demo_customize_hidden' );

Before:

https://www.evernote.com/shard/s155/sh/2106ceba-8197-44df-8367-cc1aee8da17e/2682f9db55532564c9ae86c251117930/res/f4a035f0-9cee-4ed6-8cd5-6c79a0faaa1e/customize-before.jpg

After:

https://www.evernote.com/shard/s155/sh/2106ceba-8197-44df-8367-cc1aee8da17e/2682f9db55532564c9ae86c251117930/res/0a0cf714-9446-4c3e-be5d-ca0aa3c2c4b1/customize-after.jpg

Attachments (3)

31330.patch (394 bytes) - added by dlh 10 years ago.
customize-before.jpg (22.6 KB) - added by dlh 10 years ago.
customize-after.jpg (22.2 KB) - added by dlh 10 years ago.

Download all attachments as: .zip

Change History (6)

@dlh
10 years ago

@dlh
10 years ago

@dlh
10 years ago

#1 @SergeyBiryukov
10 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.2

Looks like screenshots require an Evernote account, but the patch makes sense.

#2 @dlh
10 years ago

I've uploaded the screenshots here separately. Sorry, I thought I'd made them public on Evernote, but apparently not.

#3 @SergeyBiryukov
10 years ago

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

In 31460:

Customizer: Remove margin for hidden controls.

props dlh.
fixes #31330.

Note: See TracTickets for help on using tickets.