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

fix: Added keyboard functionality for esc and Ctrl + a #8282

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

harshit078
Copy link
Contributor

Description

Changes

Screen.Recording.2024-11-02.at.2.17.14.AM.mov

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Implemented keyboard shortcuts for record selection in the drag select component, adding support for Ctrl/Cmd + A to select all records and Escape to deselect all records.

  • Added keyboard event handler in /packages/twenty-front/src/modules/ui/utilities/drag-select/components/DragSelect.tsx for Ctrl/Cmd + A and Escape shortcuts
  • Uses queueMicrotask to handle selection changes asynchronously for better performance
  • Queries elements with data-selectable-id attribute to manage record selection state
  • Prevents default browser behavior for both keyboard shortcuts to avoid conflicts

1 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +58 to +61
useEffect(() => {
document.addEventListener('keydown', handleKeyDown);
return () => document.removeEventListener('keydown', handleKeyDown);
}, [handleKeyDown]);
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Global event listener could interfere with other keyboard shortcuts when multiple DragSelect components are mounted. Consider using a more scoped approach or checking if the dragSelectable element is in focus.

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.

1 participant