-
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
Keyboard activation of undo buttons in toolbar creates inconsistent focus behaviour #3486
Comments
@afercia what is your preference here? Should triggering an undo via the keyboard via the toolbar shift the focus away from the toolbar? |
Re:
I'd say in this case there should be:
Well, from an accessibility perspective, focus should stay on the buttons, for the reasons you've already explained 🙂 |
Haven't followed closely but I've heard the undo/redo has been recently improved. From an a11y perspective, it's best to keep focus on the buttons, which is the current behavior. Unsure what's left to do here but maybe this could be closed? /Cc @mtias |
@afercia Could you please give this another quick test and if you are happy with it, close things out? |
The problem is still there. When there are no more Undo or Redo steps, the related button (which is the focused element until then) gets disabled with a
|
Just FYI: keeping the button actually disabled requires a lot of focus management and extra actions. I tried it and it was a bit of a mess. I'll try to get this going with Still, I'll try the second option quickly first 😄 |
Issue Overview
So Gutenberg's history is managed by changing redux state. This works really well if the
undo
andredo
buttons are fired by the keyboard shortcuts (e.g. Ctrl + Z), where moving through the page history can shift the focus to the corresponding block correctly.However, if the user has navigated to the toolbar, and pressed Space / Enter to active the undo and redo buttons, the focus becomes very inconsistent
PostTitle
. This is likely because thePostTitle
focus state is not encapsulated in the redux state.Note, with (1), if the undo button becomes disabled because you get back to the start of the undo history, the focus is lost, and the focus returns to the body, breaking keyboard navigation.
With (2), this prevents a user from making multiple
undo
operations in a row. You could rather easily argue that most people would be using the Ctrl + Z shortcut, though (note, however, that this is a different operation from clicking / keyboard activating that button though ... as it goes through TinyMCE). The behaviour just seems to be inconsistent. We need to decide what should happen.a) Should keyboard activating the undo / redo buttons always transfer focus back to whatever block previously had focus? What if something else had focus in the block?
b) Should keyboard activating the undo / redo buttons always keep focus on the button. Would it work differently then if you clicked on it with the mouse?
Steps to Reproduce (for bugs)
Situation 1
Expected Behavior
The focus stays somewhere in the toolbar, or it jumps straight to the PostTitle immediately.
Current Behavior
The focus stays in the toolbar until the last undo, and then focus is just lost.
Situation 2
Expected Behavior
The focus stays somewhere in the toolbar, or it jumps to the last editable focused in the history.
Note: I also thought that pressing that button would trigger an
undo
in TinyMCE instead, but it doesn't. This means that Ctrl + Z and activating that button have completely different meanings. Is there a better way we can handle that?Current Behavior
The focus jumps to the last editable focused in the history, so this can be fine as long as it is consistent.
The text was updated successfully, but these errors were encountered: