diff --git a/packages/editor/CHANGELOG.md b/packages/editor/CHANGELOG.md index 835ff02f665cb3..b338b1a5941477 100644 --- a/packages/editor/CHANGELOG.md +++ b/packages/editor/CHANGELOG.md @@ -12,6 +12,7 @@ - Header: Allow the Back button column to grow when "Show button text labels" is enabled so the label is not obscured by the following controls ([#81701](https://github.com/WordPress/gutenberg/pull/81701)). - Notes: Stop forcing capitalization of the user name in a note byline, so the name is shown as the user set it ([#81788](https://github.com/WordPress/gutenberg/pull/81788)). - Device Preview: Center the editor canvas with the canvas container's own flex alignment rather than the canvas's auto margins, which were conditional on the resize handles being active. Switching from the mobile or tablet preview back to desktop no longer expands the canvas from the left edge ([#81484](https://github.com/WordPress/gutenberg/pull/81484)). +- `PostSchedule`: Announce the new publish date to screen readers when the date is changed ([#81629](https://github.com/WordPress/gutenberg/pull/81629)). ### Internal diff --git a/packages/editor/src/components/post-schedule/index.js b/packages/editor/src/components/post-schedule/index.js index 5c0fdb966befc9..f1a78617929784 100644 --- a/packages/editor/src/components/post-schedule/index.js +++ b/packages/editor/src/components/post-schedule/index.js @@ -1,11 +1,13 @@ import { parseISO, endOfMonth, startOfMonth } from 'date-fns'; +import { speak } from '@wordpress/a11y'; import { getSettings } from '@wordpress/date'; -import { _x } from '@wordpress/i18n'; +import { __, _x, sprintf } from '@wordpress/i18n'; import { useDispatch, useSelect } from '@wordpress/data'; import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; import { useState, useMemo } from '@wordpress/element'; import { store as coreStore } from '@wordpress/core-data'; import { store as editorStore } from '../../store'; +import { getFullPostScheduleLabel } from './label'; import { unlock } from '../../lock-unlock'; const { PrivatePublishDateTimePicker } = unlock( blockEditorPrivateApis ); @@ -42,7 +44,19 @@ export function PrivatePostSchedule( { ); const { editPost } = useDispatch( editorStore ); - const onUpdateDate = ( date ) => editPost( { date } ); + const onUpdateDate = ( date ) => { + editPost( { date } ); + speak( + date + ? sprintf( + // translators: %s: The new publish date and time, e.g. "June 3, 2025 12:00 pm UTC+0". + __( 'Publish date set to %s.' ), + getFullPostScheduleLabel( date ) + ) + : __( 'Publish date set to now.' ), + 'assertive' + ); + }; const [ previewedMonth, setPreviewedMonth ] = useState( startOfMonth( new Date( postDate ) )