Make WordPress Core


Ignore:
Timestamp:
10/02/2017 05:33:10 PM (7 years ago)
Author:
westonruter
Message:

Customize: Improve styling of date/time Customizer control.

  • Let date legend be screen reader text when time is not included.
  • Skip rendering containers for label (title) and description when not supplied in registered control.
  • Fix margins and padding.

Amends [41670].
Props westonruter, afercia, sayedwp.
Fixes #42022.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/customize/class-wp-customize-date-time-control.php

    r41670 r41672  
    113113        <# var idPrefix = _.uniqueId( 'el' ) + '-'; #>
    114114
    115         <span class="customize-control-title">
    116             {{ data.label }}
    117         </span>
     115        <# if ( data.label ) { #>
     116            <span class="customize-control-title">
     117                {{ data.label }}
     118            </span>
     119        <# } #>
    118120        <div class="customize-control-notifications-container"></div>
    119         <span class="description customize-control-description">{{ data.description }}</span>
    120         <div class="date-time-fields">
     121        <# if ( data.description ) { #>
     122            <span class="description customize-control-description">{{ data.description }}</span>
     123        <# } #>
     124        <div class="date-time-fields {{ data.includeTime ? 'includes-time' : '' }}">
    121125            <fieldset class="day-row">
    122                 <legend class="title-day"><?php esc_html_e( 'Date' ); ?></legend>
     126                <legend class="title-day {{ ! data.includeTime ? 'screen-reader-text' : '' }}"><?php esc_html_e( 'Date' ); ?></legend>
    123127                <div class="day-fields clear">
    124128                    <label for="{{ idPrefix }}date-time-month" class="screen-reader-text"><?php esc_html_e( 'Month' ); ?></label>
Note: See TracChangeset for help on using the changeset viewer.