-
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
Undo / Redo inconsistencies when using mouse or keyboard #5685
Comments
For reference: tested on current master 8434cc9 a few days after release 2.4.0. |
I encountered a similar issue when working on improvements for e2e tests in #8301:
Test which might allow to reproduce it: https://github.com/WordPress/gutenberg/blob/master/test/e2e/specs/undo.test.js You can run it as follows: |
Forgive me not being more specific, but let me just add, that Ctrl-Z, Ctrl-Y rarely gives me the expected results. Using Gutenberg 3.4 - on production site, woop woop! ;) |
gutenberg/packages/editor/src/components/rich-text/index.js Lines 403 to 423 in 7447194
@iseulde is it possible that this thing forces editor to create another undo level even when new block wasn't created or blur didn't happen? In the e2e tes (
When test fails, this is always the reason. |
I think we should remove the change event handler and replace it with our own logic so we have complete control over it. So that means: deregistering built in shortcuts and reregister them to use our own formatting methods, then create history records for any formatting change and any clicks in the editor (click = typing interruption), and maybe some other things like the ENTER key etc. Planning to have a look at this. |
Should be fixed after #10650. Please reopen if this is not the case. :) |
I see the behavior has improved a lot with regards to RichText, thanks! However, following the steps above, the post title is not restored. Depending on the flow, seems the title is not included in the undo/redo history also in other cases. GIF: Also, I understand the switch from the default (empty) block to a paragraph is included in the history, but maybe that could be potentially confusing for users. |
Yes, I think only blocks are included in the history reducers. Could you make a new issue for this? It seems unrelated to this one. |
Edits (including title) are included. |
This issue has been created: #12075. |
While investigating on #5468 I've noticed inconsistencies in the way Undo and Redo work, depending if using the mouse or the keyboard. Seems to me this feature is a bit fragile and prone to errors and probably worth some investigation.
I've tried to reduce the inconsistencies I've noticed to a few cases, hopefully easy to reproduce;
1
Undo / Redo using only the mouse:
Now click Undo multiple times through all the history steps and carefully observe what happens:
Now click Redo multiple times:
2
Undo / Redo using only the keyboard:
Now click Undo multiple times:
Now click Redo:
3
Using Cmd/Ctrl+z and Cmd/Ctrl+Shift+z:
Instead of clicking Undo and Redo, using the keyboard shortcuts generally produces the same inconsistencies except for:
Sorry I can't help further, I don't have the knowledge to understand how Undo/Redo exactly works. If I had to guess, I'd suspect history steps are saved differently when using the mouse or the keyboard. Not sure this can be fully fixed, given how the UI works. However, it would be nice to investigate on some of these cases, especially the ones that are potentially very confusing for users.
The text was updated successfully, but these errors were encountered: