-
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
Try to make the inline toolbars navigable toolbars and make Alt+F10 work #6302
Conversation
Latest commit tries to cover the point 3 from #5840 (comment) that is: in some cases the current selection is in another block, so focus gets moved back to a wrong block. Introduced a check for that and if that happens, focus is now moved back to the wrapper of the right block. Also, while testing the nested cover image PR, see #5452, I've noticed in some cases a JS TypeError happening because @youknowriad when you have a chance, I'd appreciate your thoughts on the latest commit. You can test it following the steps described in the point 3) on #5840 (comment) Thanks! |
I'm noticing some inconsistencies in how this component logic works, for example with blocks that don't have editable areas: Testing with Chrome (similar results with Firefox):
This happens also when using the keyboard, for example when starting form the "Media Library" button then press Alt+F10 and follow the steps above. The main goal should be trying to move focus back to the invoking context so I'd like to propose this fallback:
This way the component would avoid to make assumptions on the DOM structure, like in using |
One more case where which is not focusable while trying to get |
One more issue related to
We've reproduced this internally at @Yoast and have no idea why it's happening. |
Is there still a relevancy / desire to get this in? Anything I can do to help help push it forward? |
@aduth sorry for late reply. Yes: it would be great to have inline toolbars have the same keyboard interaction and shortcuts of the block toolbars. I wouldn't know how to solve the focus issue though, and I'm not sure I have the bandwidth to move this PR on. I think you've also faced the same issue in #10529 |
I think this can be closed for now: many things have changed in the meantime. This was a good exploration and can always be reconsidered later. |
Work in progress, don't merge.
Inline toolbars should work like the block toolbars:
This was quickly discussed in #5840 together with a couple other issues. Was thinking a bit at this and seems to me the most logical thing would be wrapping the inline toolbar within a
NavigableToolbar
component. And it works, in a way. It's amazing to see how reusing a component in a bit unexpected way works because the component is abstracted enough that it just works 🙂However, playing with this highlighted an issue with
focusToolbar()
because it assumes there's just one toolbar. Actually, there may be up to three toolbars:Also on current master, when pressing Alt+F10
focusToolbar()
returns two toolbars (depending also on the "fix to top" option) and it works just by coincidence because the last toolbar happens to be the right one. I guess some DOM methods could help getting the right toolbar but that would be fragile and non-Reactish. The main issue I see here is that when pressing Alt+F10, the focus/selection methods used here don't know 1) the selected block 2) the field being edited 3) which toolbar is the one to move focus to.Considering also some blocks, for example the cover image, are going to be nested blocks, how can we preserve the Alt+F10 functionality and give the application knowledge of which toolbar to focus?
/Cc @aduth @youknowriad