mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Accessibility: improve the "URL" and "Alt text" fields in the media modals.
Many users found the attachment URL field confusing: it says "URL" so it may appear like a field meant to paste a URL into. Also, the Alt text field is the most important one in terms of content, while the Title field needs to be de-emphasized. - changes the URL field label to "Copy link" - moves the alt text field to the top as first field - avoids to set initial focus on the alt text field - adds an explanatory text with a link pointing to the W3C "alt decision tree" tutorial - adds `aria-describedby` to target the explanatory text - adjusts the CSS accordingly - updates the QUnit index.html file Props melchoyce, audrasjb, afercia. Fixes #41612. git-svn-id: https://develop.svn.wordpress.org/trunk@44900 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -42,23 +42,10 @@ Details = Attachment.extend(/** @lends wp.media.view.Attachment.Details.prototyp
|
||||
rerenderOnModelChange: false
|
||||
});
|
||||
|
||||
this.on( 'ready', this.initialFocus );
|
||||
// Call 'initialize' directly on the parent class.
|
||||
Attachment.prototype.initialize.apply( this, arguments );
|
||||
},
|
||||
|
||||
initialFocus: function() {
|
||||
if ( ! wp.media.isTouchDevice ) {
|
||||
/*
|
||||
Previously focused the first ':input' (the readonly URL text field).
|
||||
Since the first ':input' is now a button (delete/trash): when pressing
|
||||
spacebar on an attachment, Firefox fires deleteAttachment/trashAttachment
|
||||
as soon as focus is moved. Explicitly target the first text field for now.
|
||||
@todo change initial focus logic, also for accessibility.
|
||||
*/
|
||||
this.$( 'input[type="text"]' ).eq( 0 ).focus();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @param {Object} event
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user