A11y: Add spoken notice when screen options are saved on change.

When some screen option input fields are changed (post table columns, welcome panel, and metabox visibility), the change is saved to options. Other screen options (e.g. number of items per page) are only saved on submit. The changes that are saved immediately are visibly changed for sighted readers immediately. Change adds a `wp.a11y.speak()` call to inform screen readers that a value change has updated screen options.

Props kkmuffme, joedolson, yogeshbhutkar, audrasjb, sourabhjain.
Fixes #62550.
Built from https://develop.svn.wordpress.org/trunk@59988


git-svn-id: http://core.svn.wordpress.org/trunk@59330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
joedolson
2025-03-16 19:40:31 +00:00
parent c2b92db37c
commit 5c784a1001
7 changed files with 40 additions and 22 deletions

View File

@@ -419,12 +419,18 @@ window.columns = {
*/
saveManageColumnsState : function() {
var hidden = this.hidden();
$.post(ajaxurl, {
action: 'hidden-columns',
hidden: hidden,
screenoptionnonce: $('#screenoptionnonce').val(),
page: pagenow
});
$.post(
ajaxurl,
{
action: 'hidden-columns',
hidden: hidden,
screenoptionnonce: $('#screenoptionnonce').val(),
page: pagenow
},
function() {
wp.a11y.speak( __( 'Screen Options updated.' ) );
}
);
},
/**

File diff suppressed because one or more lines are too long

View File

@@ -27,11 +27,17 @@ jQuery( function($) {
* @return {void}
*/
updateWelcomePanel = function( visible ) {
$.post( ajaxurl, {
action: 'update-welcome-panel',
visible: visible,
welcomepanelnonce: $( '#welcomepanelnonce' ).val()
});
$.post(
ajaxurl,
{
action: 'update-welcome-panel',
visible: visible,
welcomepanelnonce: $( '#welcomepanelnonce' ).val()
},
function() {
wp.a11y.speak( wp.i18n.__( 'Screen Options updated.' ) );
}
);
};
// Unhide the welcome panel if the Welcome Option checkbox is checked.

File diff suppressed because one or more lines are too long

View File

@@ -461,13 +461,19 @@
closed = $( '.postbox' ).filter( '.closed' ).map( function() { return this.id; } ).get().join( ',' );
hidden = $( '.postbox' ).filter( ':hidden' ).map( function() { return this.id; } ).get().join( ',' );
$.post(ajaxurl, {
action: 'closed-postboxes',
closed: closed,
hidden: hidden,
closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
page: page
});
$.post(
ajaxurl,
{
action: 'closed-postboxes',
closed: closed,
hidden: hidden,
closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
page: page
},
function() {
wp.a11y.speak( __( 'Screen Options updated.' ) );
}
);
},
/**

File diff suppressed because one or more lines are too long

View File

@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.8-beta2-59987';
$wp_version = '6.8-beta2-59988';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.