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

Holding down a shortcut invokes it repeatedly #8538

Closed
somebody1234 opened this issue Dec 13, 2023 · 3 comments · Fixed by #9537
Closed

Holding down a shortcut invokes it repeatedly #8538

somebody1234 opened this issue Dec 13, 2023 · 3 comments · Fixed by #9537
Assignees
Labels
--bug Type: bug -gui d-easy Difficulty: little prior knowledge required p-high Should be completed in the next sprint
Milestone

Comments

@somebody1234
Copy link
Collaborator

e.g. Holding down Ctrl+V to paste a node.

This is not an issue in shortcuts.ts as it provides no event handling itself.

The issue is with using useEvent(window, 'keydown'. This task will involve adding a custom composable to events.ts which avoids re-triggering the callback until after the next keyup event. Care should be taken to ensure that the keyup event wasn't of the Ctrl being released (if that is possible).

@somebody1234 somebody1234 added d-easy Difficulty: little prior knowledge required --bug Type: bug -gui p-high Should be completed in the next sprint labels Dec 13, 2023
@somebody1234
Copy link
Collaborator Author

somebody1234 commented Dec 13, 2023

On second thought it's possible to just check event.repeat: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat

So it may be possible to check for this in shortcuts.ts

MDN Web Docs
The repeat read-only property of the KeyboardEvent interface returns a boolean value that is true if the given key is being held down such that it is automatically repeating.

@farmaazon
Copy link
Contributor

Cannot we just check repeat flag of keydown event?

@farmaazon farmaazon added this to the Beta Release milestone Mar 6, 2024
@Frizi Frizi self-assigned this Mar 25, 2024
@mergify mergify bot closed this as completed in #9537 Mar 25, 2024
mergify bot pushed a commit that referenced this issue Mar 25, 2024
…min width (#9537)

Fixes #8538 #9515

All repeated keyboard events handled through `defineShortcuts` are now ignored. For example, holding ctrl+v no longer pastes nodes repeatedly.

Also adjusted visualization min-width to 200px, since it was a trivial change.

![image](https://github.com/enso-org/enso/assets/919491/7997898f-bcee-45f2-aacb-e10a49b159d6)
jdunkerley pushed a commit that referenced this issue Mar 26, 2024
…min width (#9537)

Fixes #8538 #9515

All repeated keyboard events handled through `defineShortcuts` are now ignored. For example, holding ctrl+v no longer pastes nodes repeatedly.

Also adjusted visualization min-width to 200px, since it was a trivial change.

![image](https://github.com/enso-org/enso/assets/919491/7997898f-bcee-45f2-aacb-e10a49b159d6)
@enso-bot
Copy link

enso-bot bot commented Mar 26, 2024

Paweł Grabarz reports a new STANDUP for yesterday (2024-03-25):

Progress: Fixed repeated shortcut handling bug and adjusted visualization defaults. Cleaned up rust codebase to remove large amount of no longer needed but costly to build modules. It should be finished by 2024-03-25.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
--bug Type: bug -gui d-easy Difficulty: little prior knowledge required p-high Should be completed in the next sprint
Projects
Status: 🗄️ Archived
Development

Successfully merging a pull request may close this issue.

3 participants