Skip to content
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

[Bug]: Caps lock interferes with History hotkeys #5789

Open
1 task done
vinzdef opened this issue Oct 30, 2024 · 2 comments
Open
1 task done

[Bug]: Caps lock interferes with History hotkeys #5789

vinzdef opened this issue Oct 30, 2024 · 2 comments
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@vinzdef
Copy link

vinzdef commented Oct 30, 2024

Affected Packages

extension-history

Version(s)

2.9.1

Bug Description

Description

In the editor, pressing Mod-Z should trigger undo and Mod-Shift-Z should trigger redo.
This works as expected unless "Caps lock" is enabled, then it stops working.

Environments

This affects all major browsers on Windows (tested).
Not reproducible on Mac/Chrome.

Browser Used

Chrome

Code Example URL

No response

Expected Behavior

Pressing Mod-Z should trigger undo and Mod-Shift-Z should trigger redo, even when "Caps lock" is on.

Additional Context (Optional)

Previous issues

This issue was reporting the same.
It was marked as resolved.
This is the PR that solved it.

The code introduced by that PR was then removed in this commit, I could not find an explanation as of why it was removed or if the problem was addressed elsewhere.

Dependency Updates

  • Yes, I've updated all my dependencies.
@vinzdef vinzdef added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels Oct 30, 2024
@Nantris
Copy link
Contributor

Nantris commented Oct 30, 2024

I think it might be best to try to consolidate the discussion on this commit here instead.


OK, I didn't know about caps lock, their disappearance really breaks it

I cleaned them for 2 reasons:

Mod-Z was executed before Ctrl-Shift-z, and this is wrong, and their behavior is different, this can be solved by adding auxiliary caps lock hotkeys after the rest
When we get to the end of the redo stack, and at this moment we press Ctrl-Shift-z, which is responsible for another step redo, nothing should happen in this situation, but Mod-Z is fired up, which does undo, which is incorrect, how to fix it I did not find an option


Fixing all cases of hotkey ordering and case handling has proven one of the more difficult parts of working with ProseMirror (which is not an easy project to work with in any event.)

I'm not familiar with the testing strategy for TipTap but it seems like this area should have some test cases given how brittle the configuration can be.

@webkadiz is it troublesome to create a codesandbox to demo those cases so everyone discussing can make sure we all understand the issues clearly?

@webkadiz
Copy link
Contributor

ok, I'll show the second point in the video with this configuration:

      'Mod-z': () => this.editor.commands.undo(),
      'Shift-Mod-z': () => this.editor.commands.redo(),
      'Mod-y': () => this.editor.commands.redo(),
      'Mod-Z': () => this.editor.commands.undo(),
      'Mod-Y': () => this.editor.commands.redo(),
      'Shift-Mod-Z': () => this.editor.commands.redo(),

here I write the "first step", then press ctrl-shift-z (which is responsible for redo), but when the redo stack is empty, Mod-Z is executed, which does undo, then I press ctrl-shift-z again and redo is done

ctrl-shift-z.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug
Projects
None yet
Development

No branches or pull requests

3 participants