Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Accessibility: Communicate AJAX enabling/disabling changes to screen readers #85

Merged
merged 1 commit into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function insert_into_template(positioning_text, added_text, insert_before) {
wp_enqueue_script(
'wp-autoupdates',
plugin_dir_url( __FILE__ ) . 'js/wp-autoupdates.js',
array( 'jquery', 'wp-ajax-response' ),
array( 'jquery', 'wp-ajax-response', 'wp-a11y' ),
WP_AUTO_UPDATES_VERSION,
true
);
Expand All @@ -130,6 +130,7 @@ function insert_into_template(positioning_text, added_text, insert_before) {
'disable' => __( 'Disable auto-updates', 'wp-autoupdates' ),
'disabling' => __( 'Disabling auto-updates...', 'wp-autoupdates' ),
'auto_enabled' => __( 'Auto-updates enabled', 'wp-autoupdates' ),
'auto_disabled' => __( 'Auto-updates disabled', 'wp-autoupdates' ),
)
);
}
Expand Down
6 changes: 6 additions & 0 deletions js/wp-autoupdates.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jQuery(function ($) {
$( '.autoupdate_disabled span' ).html( response.data.disabled_count );
$parent.html( response.data.return_html );
$parent.find('.plugin-autoupdate-enable').focus();
wp.a11y.speak( wp_autoupdates.auto_disabled, 'polite' );
})
.fail(function (response) {
// todo - Better error handling.
Expand Down Expand Up @@ -63,6 +64,7 @@ jQuery(function ($) {
$( '.autoupdate_disabled span' ).html( response.data.disabled_count );
$parent.html( response.data.return_html );
$parent.find('.plugin-autoupdate-disable').focus();
wp.a11y.speak( wp_autoupdates.auto_enabled, 'polite' );
})
.fail(function (response) {
// todo - Better error handling.
Expand Down Expand Up @@ -99,6 +101,7 @@ jQuery(function ($) {
$( '.autoupdate_disabled span' ).html( response.data.disabled_count );
$parent.html( response.data.return_html );
$parent.find('.theme-autoupdate-enable').focus();
wp.a11y.speak( wp_autoupdates.auto_disabled, 'polite' );
})
.fail(function (response) {
// todo - Better error handling.
Expand Down Expand Up @@ -135,6 +138,7 @@ jQuery(function ($) {
$( '.autoupdate_disabled span' ).html( response.data.disabled_count );
$parent.html( response.data.return_html );
$parent.find('.theme-autoupdate-disable').focus();
wp.a11y.speak( wp_autoupdates.auto_enabled, 'polite' );
})
.fail(function (response) {
// todo - Better error handling.
Expand Down Expand Up @@ -169,6 +173,7 @@ jQuery(function ($) {
.done(function (response) {
$parent.html( response.data.return_html );
$parent.find('.theme-autoupdate-enable').focus();
wp.a11y.speak( wp_autoupdates.auto_disabled, 'polite' );
})
.fail(function (response) {
// todo - Better error handling.
Expand Down Expand Up @@ -203,6 +208,7 @@ jQuery(function ($) {
.done(function (response) {
$parent.html( response.data.return_html );
$parent.find('.theme-autoupdate-disable').focus();
wp.a11y.speak( wp_autoupdates.auto_enabled, 'polite' );
})
.fail(function (response) {
// todo - Better error handling.
Expand Down