Skip to content

Commit

Permalink
feature: added speak on device selection
Browse files Browse the repository at this point in the history
  • Loading branch information
up1512001 committed Jul 29, 2024
1 parent f9cc02c commit 3490808
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/editor/src/components/preview-dropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { store as preferencesStore } from '@wordpress/preferences';
*/
import { store as editorStore } from '../../store';
import PostPreviewButton from '../post-preview-button';
import { speak } from '@wordpress/a11y';

export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
const { deviceType, homeUrl, isTemplate, isViewable, showIconLabels } =
Expand Down Expand Up @@ -109,6 +110,13 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
*/
const onSelect = ( value ) => {
setDeviceType( value );
if ( value === 'Desktop' ) {
speak( __( 'Desktop selected' ), 'assertive' );
} else if ( value === 'Tablet' ) {
speak( __( 'Tablet selected' ), 'assertive' );
} else {
speak( __( 'Mobile selected' ), 'assertive' );
}
};

return (
Expand Down

0 comments on commit 3490808

Please sign in to comment.