-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Description
The Placeholder component's instructions prop triggers whenever the component mounts and the instructions are defined, and this can be a little bit too much, causing it to take precedence over other messages or be announced very unexpectedly:
gutenberg/packages/components/src/placeholder/index.tsx
Lines 82 to 86 in 27fbbd8
| useEffect( () => { | |
| if ( instructions ) { | |
| speak( instructions ); | |
| } | |
| }, [ instructions ] ); |
For example, the message can be triggered when:
- loading a post
- switching between code and visual editor modes (in this case there's also supposed to be a spoken message about switching modes, but it gets clobbered by the placeholder because every time
speakis called the current spoken messages are cleared) - A pattern containing those blocks is inserted
If you have multiple blocks in a post in placeholder state they can also all try speaking at once, which is very impolite.
Feels to me like this prop doesn't work in the right way. The instructions should probably only be read when the block is interacted with (selected?) and even then some care needs to be taken to ensure it only happens infrequently preferably on the first interaction. I'd question whether a spoken message is the right option at all as I think they're best for providing feedback about a current user action, but it'd be good to get further accessibility feedback on that.
Step-by-step reproduction instructions
- Insert a group block into a post and leave it in the placeholder state
- In the Editor options menu, switch to Code Editor mode
- Switch back to Visual editor mode
Note that the spoken message for switching back to Visual Editor mode is never announced and the assertive aria-live region is empty. The group block's instructions can be announced even though they're polite` and not currently being interacted with.
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes