-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Announce when block inserted in Navigation list view #47034
Announce when block inserted in Navigation list view #47034
Conversation
There's a problem here in that if you have an empty menu and then you insert a block (leaving you with a single block in the list view) it will announce that block each time the list view is rendered. To replicate:
@scruffian this is because we refactored to a selector which will always return the last block inserted even if it was inserted ages ago. Perhaps we need a means to manually clear the lastInsertedBlock via an action but that might end up causing other bugs. Suggestion: the state has a |
Size Change: +101 B (0%) Total Size: 1.33 MB
ℹ️ View Unchanged
|
Flaky tests detected in 4b06625. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3902164923
|
One thing I am curious about here is whether it would always be useful to have this kind of feedback? Would it be helpful to always have a "speak" announcement when a block is added to the canvas (not just for the Navigation block)? |
@scruffian Weirdly that's exactly what multi-select does already. Unfortunately it's only for block count. gutenberg/packages/block-editor/src/store/actions.js Lines 312 to 319 in f4585c5
If we want the |
@alexstine How useful do you feel it would be for the Nav block list view to announce (via |
@getdave could we add it here?
|
I think there's a simpler way to handle this. I'll try and raise a PR now. |
891db0c
to
9ab4acc
Compare
So @scruffian here's what I've done:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be an improvement on the current situation. I noticed that when I added a "Page Link" block I get the announcement "1 block added" rather than the name of the block. It would be good to fix this but I think it can happen in a followup.
I would find the announcement useful. Letting the user know an action completed is always good. However, Announcing the name of the block inserted may be a good thing. I do not think it currently works this way but could be an improvement that could be good for both. Thanks. |
I'd assumed that we'd want to keep focus in the list view as it's likely the user is trying to build out a menu and transferring focus away from that environment (for all users) would be frustrating. My question was once you've inserted the block should focus remain on the appender (in the list view) or transfer to the list view node for the block you just inserted? At the moment the focus remains on the appender which is why I felt having an announcement that the insert block action completed successfully would be value. I'll continue with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@getdave Perfect. Thanks.
4b06625
to
e0cbd2a
Compare
What?
Announces via
speak()
when a block is inserted into the Navigation block's list view in the form:Why?
Currently once you insert a block in the list view there is no notice that the block is inserted. This is because the block's selection is disabled to avoid moving focus away from the Navigation block's inspector controls sidebar.
By adding this announcement it is clearer to users of assistive technology that a block has been inserted.
How?
Announces name of last selected block.
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast