Make WordPress Core


Ignore:
Timestamp:
09/03/2017 04:01:18 PM (9 years ago)
Author:
afercia
Message:

Accessibility: Improve the color picker UI accessibility, interaction, and generated markup.

  • Refactors the UI controls around the Iris color picker to output valid and semantic markup
  • Simplifies the way elements visibility gets toggled
  • Properly associates the visually hidden label with the color input field
  • Makes the toggle button a real button
  • Adds aria-expanded to the toggle button
  • Keeps focus on the toggle button instead of moving it to the color input field
  • Adds aria-label attributes to give better context to some controls
  • Removes a redundant title attribute
  • Keeps the toggle button text to "Select Color" instead of changing it to "Current Color" when a color is selected
  • Slightly improves the responsive view
  • CSS clean-up

Fixes #39662.

File:
1 edited

Legend:

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

    r41256 r41329  
    100100                        defaultValueAttr = ' data-default-color=' + defaultValue; // Quotes added automatically.
    101101                } #>
    102                 <label>
    103                         <# if ( data.label ) { #>
    104                                 <span class="customize-control-title">{{{ data.label }}}</span>
    105                         <# } #>
    106                         <# if ( data.description ) { #>
    107                                 <span class="description customize-control-description">{{{ data.description }}}</span>
    108                         <# } #>
    109                         <div class="customize-control-content">
    110                                 <# if ( isHueSlider ) { #>
    111                                         <input class="color-picker-hue" type="text" data-type="hue" />
    112                                 <# } else { #>
    113                                         <input class="color-picker-hex" type="text" maxlength="7" placeholder="{{ defaultValue }}" {{ defaultValueAttr }} />
    114                                 <# } #>
    115                         </div>
    116                 </label>
     102                <# if ( data.label ) { #>
     103                        <span class="customize-control-title">{{{ data.label }}}</span>
     104                <# } #>
     105                <# if ( data.description ) { #>
     106                        <span class="description customize-control-description">{{{ data.description }}}</span>
     107                <# } #>
     108                <div class="customize-control-content">
     109                        <label><span class="screen-reader-text">{{{ data.label }}}</span>
     110                        <# if ( isHueSlider ) { #>
     111                                <input class="color-picker-hue" type="text" data-type="hue" />
     112                        <# } else { #>
     113                                <input class="color-picker-hex" type="text" maxlength="7" placeholder="{{ defaultValue }}" {{ defaultValueAttr }} />
     114                        <# } #>
     115                        </label>
     116                </div>
    117117                <?php
    118118        }
Note: See TracChangeset for help on using the changeset viewer.