Skip to content

Conversation

@rakesh0x
Copy link
Contributor

@rakesh0x rakesh0x commented Jun 12, 2025

Description:

This PR introduces a keyboard shortcut (Ctrl + Z) to restore the most recently deleted block from the Trash in Music Blocks.

It improves the user experience by allowing children and users to quickly undo accidental deletions without needing to manually open the trash interface.

Changes Made
Added a global keyboard event listener to capture Ctrl + Z.

Invoked the existing restoreTrashPop functionality on Ctrl + Z.

Ensured the shortcut does not interfere with default browser behavior (event.preventDefault()).

Updated restoreTrash and related functions to integrate cleanly with the shortcut.

Why This is Useful
Children often delete blocks accidentally while exploring.

A familiar shortcut like Ctrl + Z makes it intuitive and accessible.

Promotes ease of use and efficiency in creative workflows.

Testing
✅ Pressing Ctrl + Z restores the last deleted block if trash is not empty.

✅ If trash is empty, a message appears: “Trash can is empty.”

✅ Existing mouse-based trash restoration continues to work as expected.

✅ No interference with other features or shortcuts observed.

Related Issues / Discussions
None explicitly reported, but aligns with usability improvements.

Checklist
Feature works as expected.

No breaking changes.

Code is clean and modular.

Feature tested manually.

Followed existing project style and conventions.

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@rakesh0x
Copy link
Contributor Author

@walterbender Could you please take a look, and let me know if any changes are needed

@walterbender
Copy link
Member

I wonder if this shortcut could not be handled in the code block beginning at Line 3162 (the control-key shortcut section)?

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@rakesh0x
Copy link
Contributor Author

it should work now

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@rakesh0x rakesh0x closed this Jun 16, 2025
@rakesh0x rakesh0x deleted the Restoretrash branch June 16, 2025 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants