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

Redo shortcut CTRL+Y does not work on German keyboard layout #1842

Closed
nikku opened this issue Feb 10, 2023 · 9 comments
Closed

Redo shortcut CTRL+Y does not work on German keyboard layout #1842

nikku opened this issue Feb 10, 2023 · 9 comments
Assignees
Labels
bug Something isn't working modeling

Comments

@nikku
Copy link
Member

nikku commented Feb 10, 2023

Describe the Bug

I cannot use the CTRL+Y shortcut on Windows / Linux anymore to trigger redo.

Steps to Reproduce

  1. Open https://demo.bpmn.io/s/start
  2. Perform change
  3. CTRL+Z + CTRL+Y
  4. Observe undo works, while redo does not

Expected Behavior

Redo shortcut works.

Environment

  • Browser: Chrome 110
  • OS: Linux, Windows
  • Library version: 11.3.0
@nikku nikku added bug Something isn't working modeling labels Feb 10, 2023
@nikku
Copy link
Member Author

nikku commented Feb 10, 2023

Broke with [email protected] / [email protected].

@nikku nikku self-assigned this Feb 14, 2023
@nikku nikku added the ready Ready to be worked on label Feb 14, 2023
@nikku nikku changed the title Redo shortcut CTRL+Y does not work Redo shortcut CTRL+Y does not work / German keyboard layout Feb 14, 2023
@nikku nikku changed the title Redo shortcut CTRL+Y does not work / German keyboard layout Redo shortcut CTRL+Y does not work on German keyboard layout Feb 14, 2023
@nikku
Copy link
Member Author

nikku commented Feb 14, 2023

Root causing this:

  • diagram-js < 11 we intercepted both key (actual key) and keyCode / which (physical key). We had a workaround in place for German keyboards and removed it with 11.0.0 (bpmn-io/diagram-js@ff861b0#r100581210).
  • What we have now in place is a behavior where physical keys, depending on the keyboard shortcut registration order, overrule actual keys, so both y and KeyZ on German keyboards will trigger undo

A proper solution would likely value actual keys over physical keys:

  • We first process bindings against actual keys
  • THEN we process bindings against physical keys (in case actual keys did not trigger a change yet)

The alternative:

  • Don't bind physical keys at all (only actual keys)
  • Potentially make it extensible (i.e. allow to specify additional keys for special keyboard layouts; but even then these can be mapped as actual keys, not physical keys)

@philippfromme
Copy link
Contributor

I can reproduce the issue. Using a German keyboard layout:

German keyboard produces "z", "KeyY" for Z and "y", "KeyZ" for Y
Englisch keyboard produces "y", "KeyY" for Z and "z", "KeyZ" for Y

As a result when pressing Y the undo listener matches.

A proper solution would likely value actual keys over physical keys:

  • We first process bindings against actual keys
  • THEN we process bindings against physical keys (in case actual keys did not trigger a change yet)

That's what we have to do. Or drop code alltogether.

@philippfromme
Copy link
Contributor

@nikku Do you want to go ahead and prototype the solution or should I give it a try?

@nikku
Copy link
Member Author

nikku commented Feb 15, 2023

@philippfromme I've sketched an alternative:

The alternative:

  • Don't bind physical keys at all (only actual keys)
  • Potentially make it extensible (i.e. allow to specify additional keys for special keyboard layouts; but even then these can be mapped as actual keys, not physical keys)

If we ever want to support non latin keyboards (where users expect undo to be triggered on the physical KeyY position we'd need to build that, one way or the other). What would be your preference?

@philippfromme
Copy link
Contributor

It sounds like the alternative would be to right approach in the long term so why don't we just implement that instead of wasting time on an intermediate fix?

@nikku
Copy link
Member Author

nikku commented Feb 15, 2023

If I understand you correctly (#1842 (comment)) you second the alternative I sketched.

I#ll go ahead and remove the physical key fix then. We can then (potentially, some day in the future), add support for shortcut customization / physical key positions.

@philippfromme
Copy link
Contributor

I#ll go ahead and remove the physical key fix then. We can then (potentially, some day in the future), add support for shortcut customization / physical key positions.

👍🏻

@nikku
Copy link
Member Author

nikku commented Feb 16, 2023

Closed via 530b61e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working modeling
Projects
None yet
Development

No branches or pull requests

2 participants