-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[RNMobile] Improve block inserter accessibility #25549
[RNMobile] Improve block inserter accessibility #25549
Conversation
@etoledom could you please add yourself as a reviewer to this PR. Thank you 🙇 |
I'm not sure why these tests are failing. How can these be re-run? |
After doing some more research within the codebase and elsewhere I realized there's an example of using a ref to set the accessibility focus. This was done in the Add Mobile Spacer component PR. So my idea is to track which block is currently focused using a custom hook. |
Thanks for checking @guarani I am not able to see the re-run button so I think because I haven't merged in three PRs as yet I am not a contributor so I probably don't have that permission. When the three PRs I have opened are merged I should be good. Could you trigger another re-run for me? It might be that these tests are flaky. |
@jd-alexander I re-triggered them now.
Gotcha 👌 |
My changes probably broke some tests so I'm gonna do an investigation. |
I will be fixing these conflicts soon to get this in the review queue 🙏 |
@etoledom the CI builds have been giving a lot of issues today hence the failure in the builds. You can still give this a try and let me know your thoughts on it. Thank you. |
So after doing some debugging, I am getting a weird failure in my environment. When I run the gutenberg/packages/react-native-editor/__device-tests__/gutenberg-editor-gallery.test.js Line 37 in 7532a48
When I dug into the
Looking at the function parameters there is a default So I am wondering if the way how my test is being run locally is incorrect in some way. I just looked at another PR and saw the video of the test result and realized an empty editor is being used when the test was run. |
Yay! so the test was indeed fixed with my change 🥳 I am going to fix the associated PR now that I am figuring out the issue with my local environment which was caused due to an incorrect command. |
All is well here @etoledom for another review. This and 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.
Tested on iOS and Android and it's working great!
Thank you for this improvement @jd-alexander 🙏
Note: I am merging this PR even though there are failed tests as these tests aren't the result of changes made in this PR. |
Fixes wordpress-mobile/gutenberg-mobile#915
Solution
The
MenuItem
that gets rendered for each block within the Inserter was given the role ofbutton
and it's accessibility label was appended withblock
to make it clearer that the options in the menu are to add blocks.The
open
event of the Inserter's bottom sheet now announces it's state so the user knows that there's a view that is overlaying the rest of the content. The copy is as follows.Scrollable block menu opened. Select a block.
Scrollable block menu closed.
Concerns
The only concern I have with this functionality is how I had to implement it on iOS. Firstly, I had to put a
delay
so that the announcement wasn't triggered during the screen changes else the announcement wouldn't be made at all. Also since an announcement is being made it's interrupting VoiceOver's behavior when it's attempting to refocus on the first element on the screen.I was thinking that I could add an event listener to the custom announcements created and then tell VoiceOver to focus on those elements once the announcements are done. I wanted to try this but I wasn't sure how to get a reference to the first
View
on the screen.Testing
Screenshots
Android
Click to see screenshots
iOS
Click to see screenshots
Reviewing
Only 1 reviewer is needed but anyone can review.
Checklist: