Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#31540 closed enhancement (fixed)

Dropdown pages Customizer description option

Reported by: _smartik_'s profile _smartik_ Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.1.1
Component: Customize Keywords: has-patch needs-testing
Focuses: ui Cc:


The only control missing a description is 'dropdown-pages'.

Attachments (3)

class-wp-customize-control.php (31.7 KB) - added by _smartik_ 9 years ago.
Added description support for 'dropdown-pages' control
31540.2.diff (1021 bytes) - added by MikeHansenMe 9 years ago.
31540.3.diff (1.2 KB) - added by downstairsdev 9 years ago.

Download all attachments as: .zip

Change History (15)

9 years ago

Added description support for 'dropdown-pages' control

9 years ago

#1 @MikeHansenMe
9 years ago

I looked through class-wp-customize-control.php and there is a lot of stuff changed in there. I created a patch 31540.2.diff for the item mentioned in this ticket and used a similar structure to other items in the switch.

#2 @MikeHansenMe
9 years ago

  • Keywords has-patch added

#3 @westonruter
9 years ago

  • Milestone changed from Awaiting Review to Future Release

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.

9 years ago

#5 @afercia
9 years ago

  • Focuses accessibility removed

While I agree that for consistency also the dropdown-pages control should have a description, I'm going to remove the accessibility focus. This control does have a label and this is the most important thing from an accessibility point of view. Feel free to add the keyword again if I'm missing something.

The description is currently used to "expand" the label text. I'm not sure having this expanded text (wich may be very long) inside the label element is a good thing for semantics. See screenshot below. Labels should be very short. Expanded descriptions should be after the form element. By the way this is out of this ticket scope and affects all the controls. WIll report in a separate ticket.

#6 follow-up: @downstairsdev
9 years ago

Hi @afercia. Did you have a chance to file that ticket about moving descriptions below elements? If so, could you link?

I agree the description should be added. I found this ticket while trying to trace down why it wasn't showing up for me in a theme.

The latest patch from @MikeHansenMe worked well for me. I tested it and will post a refresh.

If anyone else would like to test, here's some boilerplate dropdown customizer code you can drop in:

 * Add page selector to the customizer.
 * @since Theme 1.0.0
 * @param WP_Customize_Manager $wp_customize Customizer object.
function prefix_customize_register( $wp_customize ) {

	$wp_customize->add_section( 'dropdown-pages-example' , array(
		'title'      => __( 'Dropdown Pages', 'textdomain' ),
		'priority'   => 30,
	) );

	// Add color scheme setting and control.
	$wp_customize->add_setting( 'showcase-page-1', array(
		'default'           => '',
		'sanitize_callback' => 'absint'
	) );

	$wp_customize->add_control( 'showcase-page-1', array(
		'label'    => __( 'Select Page', 'textdomain' ),
		'section'  => 'dropdown-pages-example',
		'type'     => 'dropdown-pages',
		'description' => __( 'Testing description.', 'textdomain' ),
	) );

add_action( 'customize_register', 'prefix_customize_register', 12 );

#7 in reply to: ↑ 6 @afercia
9 years ago

Replying to downstairsdev:

Hi @afercia. Did you have a chance to file that ticket about moving descriptions below elements? If so, could you link?

Hi @downstairsdev, it was reported in this ticket: Notice that ticket was originally meant to be a tracking ticket for general Customizer accessibility issues but then changed in a ticket for just one specific issue. So we should split ouf from the ticket all the secondary issues and create separate tickets.

#8 @downstairsdev
9 years ago

For context, @celloexpressions mentioned via Twitter they really just had the core use case in mind when building this control. So it makes sense why description wasn't originally included. However, I feel like a lot of people are using it for their own themes and integrations now- so this should be added for consistency.

#9 @celloexpressions
9 years ago

  • Keywords needs-refresh added
  • Milestone changed from Future Release to 4.4

#33085 has the accessibility fixes. We should proceed with 31540.3.diff here in the meantime as it's consistent with everything else.

The label element needs to retain the customize-control-select class; other than that, this should be ready for commit.

Also, for reference,

#10 follow-up: @DrewAPicture
9 years ago

  • Keywords needs-testing added; needs-refresh removed

@afercia: Can you please review 31540.3.diff as it apparently contains accessibility fixes?

#11 in reply to: ↑ 10 @afercia
9 years ago

@DrewAPicture I'd agree with @celloexpressions:

#33085 has the accessibility fixes. We should proceed with 31540.3.diff​ here in the meantime as it's consistent with everything else.

#12 @wonderboymusic
9 years ago

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

In 35275:

Customizer: when available, show the description when rendering the dropdown-pages Control.

Props downstairsdev, MikeHansenMe, _smartik_.
Fixes #31540.

Note: See TracTickets for help on using tickets.