Accessibility: Improve accessibility of all the media views form controls.

- changes the media views form controls to have explicitly associated labels with for/id attributes
- adds a few missing labels / aria-labels
- improves a few existing labels / aria-labels
- improves semantics in a few places, by adding visually hidden headings, fieldset + legend elements, aria-describedby attributes
- improves the image custom size input fields and their labelling
- adds `role="status"` to the "saved" indicator so that status messages are announced to assistive technologies
- swaps the columns source order in the image details template, to make visual and DOM order match
- swaps the "Replace" and "Back" buttons source order in the Replace Image view, to make visual and DOM order match
- gallery settings: move checkbox label to the right: checkboxes are supposed to have labels on the right
- merge similar strings, unified to "Drop files to upload" (removed "Drop files here", and "Drop files anywhere to upload")
- makes the "upload-ui" consistent across the media views
- hides the IE 11 "X" `::-ms-clear` button in the Insert from URL field, as it conflicts with the uploading spinner
- adds comments to all the media templates to clarify their usage
- slightly increases vertical spacing between form fields in the media sidebar
- removes some CSS selectors introduced as backwards compatibility for WordPress pre-4.4
- removes some CSS still targeting Internet Explorer 7 and 8

Fixes #47141.
Fixes #47122.


git-svn-id: https://develop.svn.wordpress.org/trunk@45499 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrea Fercia
2019-06-07 20:43:26 +00:00
parent ffe40885a1
commit 226dc75154
10 changed files with 644 additions and 617 deletions
+4 -4
View File
@@ -67,9 +67,9 @@
overflow: visible;
}
.media-embed-details .embed-media-settings .setting span {
max-width: 400px;
width: auto;
.media-embed-details .embed-media-settings .setting span:not(.button-group) {
max-width: 400px; /* Back-compat for pre-5.3 */
width: auto; /* Back-compat for pre-5.3 */
}
.media-embed-details .embed-media-settings .checkbox-setting span {
@@ -94,7 +94,7 @@
}
.media-embed-details .setting .remove-setting {
padding: 0;
padding: 5px 0;
}
.media-embed-details .setting a:hover {
+6 -5
View File
@@ -1,5 +1,6 @@
var View = wp.media.View,
$ = jQuery,
l10n = wp.media.view.l10n,
EmbedUrl;
/**
@@ -13,17 +14,17 @@ var View = wp.media.View,
* @augments Backbone.View
*/
EmbedUrl = View.extend(/** @lends wp.media.view.EmbedUrl.prototype */{
tagName: 'label',
tagName: 'span',
className: 'embed-url',
events: {
'input': 'url',
'keyup': 'url',
'change': 'url'
'input': 'url'
},
initialize: function() {
this.$input = $('<input id="embed-url-field" type="url" />').val( this.model.get('url') );
this.$input = $( '<input id="embed-url-field" type="url" />' )
.attr( 'aria-label', l10n.insertFromUrlTitle )
.val( this.model.get('url') );
this.input = this.$input[0];
this.spinner = $('<span class="spinner" />')[0];
+2 -2
View File
@@ -134,7 +134,7 @@ ImageDetails = Select.extend(/** @lends wp.media.view.MediaFrame.ImageDetails.pr
items: {
back: {
text: l10n.back,
priority: 20,
priority: 80,
click: function() {
if ( previous ) {
frame.setState( previous );
@@ -147,7 +147,7 @@ ImageDetails = Select.extend(/** @lends wp.media.view.MediaFrame.ImageDetails.pr
replace: {
style: 'primary',
text: l10n.replace,
priority: 80,
priority: 20,
requires: { selection: true },
click: function() {
@@ -66,7 +66,7 @@ AttachmentDisplay = Settings.extend(/** @lends wp.media.view.Settings.Attachment
attachment = this.options.attachment;
if ( 'none' === linkTo || 'embed' === linkTo || ( ! attachment && 'custom' !== linkTo ) ) {
$input.addClass( 'hidden' );
$input.closest( '.setting' ).addClass( 'hidden' );
return;
}
@@ -82,7 +82,7 @@ AttachmentDisplay = Settings.extend(/** @lends wp.media.view.Settings.Attachment
$input.prop( 'readonly', 'custom' !== linkTo );
}
$input.removeClass( 'hidden' );
$input.closest( '.setting' ).removeClass( 'hidden' );
// If the input is visible, focus and select its contents.
if ( ! wp.media.isTouchDevice && $input.is(':visible') ) {