-
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
Persist focus when tabbing back to the block toolbar #25760
Conversation
Size Change: +206 B (0%) Total Size: 1.21 MB
ℹ️ View Unchanged
|
I found one edge case when testing: The issue is that the index is persisted even when you move to another block. It wouldn't be a bad idea if those blocks would have the same set of toolbar items, but they differ a lot. Would it be feasible to use at least the block type name to ensure that it doesn't produce unexpected behaviors? Well, it might be even necessary to use the block client id as a way to determine if the persisted initial index should be used. |
Thanks, @gziolo! I confirmed the issue and it should be fixed now (hopefully, if e2e tests pass). I think we have some options to persist the active toolbar item index:
For now, I think the first one is the simplest option, but we can explore the others if it's not enough. |
I see some failing e2e tests on node 1 but they exists in I'm fine with the simplest solution proposed. In fact, it might be the most expected behavior if you think about it from the user's perspective. When you edit a block then you are in the "Edit mode", so going back and forth between the toolbar and content is simplified when the last position is persisted. As soon as you move focus to another block you start fresh and might be easier to navigate starting from the beginning of the toolbar, especially if the number and type of items differ between blocks. Again, when you move back to the block you edited previously, you probably won't remember what was your action, so having the focus on the start of the block is the most reasonable in my opinion. |
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.
It works as advertised with the last changes applied. Nice work on this improvement 👍
Fixes #24469
This PR adds a new experimental feature to the block toolbar so it "remembers" the last focused toolbar item when the user Tabs back to the toolbar after it is unmounted.
How to test
Also, see the added e2e test.
What's not covered by this PR