By tedbow on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.7.x
Introduced in version:
8.7.0
Issue links:
Description:
A new AnnounceCommand allows triggering screen reader announcements as part of Ajax responses. The new command will trigger the announcement via the Drupal.announce() JavaScript method.
To use the command simply add it to a \Drupal\Core\Ajax\AjaxResponse object like any other command that implements \Drupal\Core\Ajax\CommandInterface.
For example:
$response = new AjaxResponse();
// Operation with the default priority which is currently 'polite'.
$response->addCommand(new AnnounceCommand('The operation has been completed.'));
// Operation with 'assertive' priority.
$response->addCommand(new AnnounceCommand('Important operation has been completed.', AnnounceCommand::PRIORITY_ASSERTIVE));
return $response;
Impacts:
Module developers
Themers