Skip to content

fix: #2719 Shortcuts Ctrl + Shift + 1 and Ctrl + Shift + 2 aren't wor… #2720

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

Merged
merged 7 commits into from
Jun 5, 2024

Conversation

aryanas159
Copy link
Contributor

…king.

Fixes #2719
Changes:
Added a mapping for '!' -> 1, '@' -> 2, because due to the shift key Ctrl + Shift + 1 was being registered as Ctrl + Shift + !, which wasn't triggering the event.
I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #123
Untitled.video.-.Made.with.Clipchamp.2.mp4

Copy link

welcome bot commented Dec 14, 2023

🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already.

@lindapaiste
Copy link
Collaborator

lindapaiste commented Dec 14, 2023

Great catch on the problem! 🧤

The KeyboardEvent interface's key read-only property returns the value of the key pressed by the user, taking into consideration the state of modifier keys such as Shift as well as the keyboard locale and layout.

I wonder if there's a better way to handle this which doesn't involve manual mapping. Like if there is a property other than e.key which we can look at. It seems like maybe e.code would work?

The KeyboardEvent.code property represents a physical key on the keyboard (as opposed to the character generated by pressing the key). In other words, this property returns a value that isn't altered by keyboard layout or the state of the modifier keys

I also want to look into how CodeMirror handles their keymaps, and maybe we can copy something from their source code.

@aryanas159
Copy link
Contributor Author

Great idea @lindapaiste e.code works well, I have pushed the changes.
Also, I checked out the CodeMirror repo and it doesn't seem like they have a keymapping for ctrl+shift+{any number}.

@aryanas159
Copy link
Contributor Author

Hey, @lindapaiste could you please review the changes?

@raclim raclim added Area:Accessibility Category for accessibility related features and bugs Bug Error or unexpected behaviors labels Jan 26, 2024
Copy link
Collaborator

@raclim raclim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work on this!

@raclim raclim merged commit dd22eda into processing:develop Jun 5, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:Accessibility Category for accessibility related features and bugs Bug Error or unexpected behaviors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Shortcuts Ctrl + Shift + 1 and Ctrl + Shift + 2 aren't working.
3 participants