mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Accessibility: Add an ARIA role button
to links that behave like buttons when JavaScript is on.
Introduces a simple way to give a proper semantics of `button` to links that behave like UI controls when JavaScript is on and behave like actual links when JavaScript is off. First implementation on the Terms list table. Patch prepared during WordCamp US 2015 Contributor Day. Props mcapybara, garusky, takayukister. See #26504. Fixes #34867. Built from https://develop.svn.wordpress.org/trunk@35947 git-svn-id: http://core.svn.wordpress.org/trunk@35911 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8db5455eea
commit
282e7c36eb
@ -430,10 +430,10 @@ class WP_Terms_List_Table extends WP_List_Table {
|
|||||||
$actions = array();
|
$actions = array();
|
||||||
if ( current_user_can( $tax->cap->edit_terms ) ) {
|
if ( current_user_can( $tax->cap->edit_terms ) ) {
|
||||||
$actions['edit'] = '<a href="' . esc_url( $edit_link ) . '">' . __( 'Edit' ) . '</a>';
|
$actions['edit'] = '<a href="' . esc_url( $edit_link ) . '">' . __( 'Edit' ) . '</a>';
|
||||||
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>';
|
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline aria-button-if-js">' . __( 'Quick Edit' ) . '</a>';
|
||||||
}
|
}
|
||||||
if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
|
if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
|
||||||
$actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>";
|
$actions['delete'] = "<a class='delete-tag aria-button-if-js' href='" . wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>";
|
||||||
if ( $tax->public )
|
if ( $tax->public )
|
||||||
$actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View' ) . '</a>';
|
$actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View' ) . '</a>';
|
||||||
|
|
||||||
|
@ -897,10 +897,20 @@ $document.ready( function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Add an ARIA role `button` to elements that behave like UI controls when JavaScript is on.
|
||||||
|
function aria_button_if_js() {
|
||||||
|
$( '.aria-button-if-js' ).attr( 'role', 'button' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$( document ).ajaxComplete( function() {
|
||||||
|
aria_button_if_js();
|
||||||
|
});
|
||||||
|
|
||||||
window.wpResponsive.init();
|
window.wpResponsive.init();
|
||||||
setPinMenu();
|
setPinMenu();
|
||||||
currentMenuItemHasPopup();
|
currentMenuItemHasPopup();
|
||||||
makeNoticesDismissible();
|
makeNoticesDismissible();
|
||||||
|
aria_button_if_js();
|
||||||
|
|
||||||
$document.on( 'wp-pin-menu wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu', setPinMenu );
|
$document.on( 'wp-pin-menu wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu', setPinMenu );
|
||||||
});
|
});
|
||||||
|
2
wp-admin/js/common.min.js
vendored
2
wp-admin/js/common.min.js
vendored
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.5-alpha-35946';
|
$wp_version = '4.5-alpha-35947';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user