Accessibility: Comments: Improve links and buttons semantics and interaction.

With the exception of the "Edit" link, the "row actions" controls in the Comments table behave differently depending if JavaScript support is on or off.
When JavaScript support is off, they behave like links. When JavaScript support is on, they behave like buttons and they need to be buttons or have an ARIA `role="button"` added via JavaScript.

Lastly, the buttons in the Reply/Quick Edit form and the "Add Comment" in the edit post page meta box need to be buttons.

Fixes #43412.

Built from https://develop.svn.wordpress.org/trunk@44759


git-svn-id: http://core.svn.wordpress.org/trunk@44591 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia
2019-02-20 23:37:50 +00:00
parent 2cbb1bd95e
commit 6fe48278ea
7 changed files with 24 additions and 28 deletions

View File

@@ -288,7 +288,7 @@ window.setCommentsList = function() {
a = $('.undo a', '#undo-' + id);
a.attr('href', 'comment.php?action=un' + action + 'comment&c=' + id + '&_wpnonce=' + settings.data._ajax_nonce);
a.attr('data-wp-lists', 'delete:the-comment-list:comment-' + id + '::un' + action + '=1');
a.attr('class', 'vim-z vim-destructive');
a.attr('class', 'vim-z vim-destructive aria-button-if-js');
$('.avatar', el).first().clone().prependTo('#undo-' + id + ' .' + action + '-undo-inside');
a.click(function( e ){
@@ -582,8 +582,8 @@ window.commentReply = {
init : function() {
var row = $('#replyrow');
$('a.cancel', row).click(function() { return commentReply.revert(); });
$('a.save', row).click(function() { return commentReply.send(); });
$( '.cancel', row ).click( function() { return commentReply.revert(); } );
$( '.save', row ).click( function() { return commentReply.send(); } );
$( 'input#author-name, input#author-email, input#author-url', row ).keypress( function( e ) {
if ( e.which == 13 ) {
commentReply.send();
@@ -631,8 +631,6 @@ window.commentReply = {
$('#replyrow').fadeOut('fast', function(){
commentReply.close();
});
return false;
},
close : function() {
@@ -808,8 +806,6 @@ window.commentReply = {
success : function(x) { commentReply.show(x); },
error : function(r) { commentReply.error(r); }
});
return false;
},
show : function(xml) {

File diff suppressed because one or more lines are too long