Skip to content

Conversation

@ShivaGupta-14
Copy link
Contributor

Description

  • Add enabled parameter to useHotkeys hook with default true value

  • Pass hotkeysEnabled state to all useHotkeys calls in Tasks component

  • Add hotkeysEnabled check in manual keyboard handler (ArrowUp/Down/Enter)

  • Add data-testid to tasks table container for testing

  • Add tests for useHotkeys enabled parameter

  • Add tests for hotkeys enable/disable on mouse hover

  • Fixes: bug: hotkeysEnabled state is set but never checked before executing hotkeys #425

Checklist

  • Ran npx prettier --write . (for formatting)
  • Ran gofmt -w . (for Go backend)
  • Ran npm test (for JS/TS testing)
  • Added unit tests, if applicable
  • Verified all tests pass
  • Updated documentation, if needed

Additional Notes

Video:

Screen.Recording.2026-01-22.at.1.17.29.AM.mov

- Add `enabled` parameter to useHotkeys hook with default true value
- Pass hotkeysEnabled state to all useHotkeys calls in Tasks component
- Add hotkeysEnabled check in manual keyboard handler (ArrowUp/Down/Enter)
- Add data-testid to tasks table container for testing
- Add tests for useHotkeys enabled parameter
- Add tests for hotkeys enable/disable on mouse hover
@github-actions
Copy link

Thank you for opening this PR!

Before a maintainer takes a look, it would be really helpful if you could walk through your changes using GitHub's review tools.

Please take a moment to:

  • Check the "Files changed" tab
  • Leave comments on any lines for functions, comments, etc. that are important, non-obvious, or may need attention
  • Clarify decisions you made or areas you might be unsure about and/or any future updates being considered.
  • Finally, submit all the comments!

More information on how to conduct a self review:
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-proposed-changes-in-a-pull-request

This helps make the review process smoother and gives us a clearer understanding of your thought process.

Once you've added your self-review, we'll continue from our side. Thank you!

) : (
<div
ref={tableRef}
data-testid="tasks-table-container"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

added data-testid for testing hover behavior

Copy link
Contributor Author

Choose a reason for hiding this comment

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

implement checking of hotkeysEnabled state before executing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added tests for hotkeysEnabled behavior

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added tests for enabled

export function useHotkeys(
keys: string[],
callback: () => void,
enabled: boolean = true
Copy link
Contributor Author

@ShivaGupta-14 ShivaGupta-14 Jan 21, 2026

Choose a reason for hiding this comment

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

enabled with default true and when it false, hook will return early without adding any event listeners

Copy link
Contributor Author

@ShivaGupta-14 ShivaGupta-14 left a comment

Choose a reason for hiding this comment

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

self review done, ready for review

@its-me-abhishek
Copy link
Collaborator

@ShivaGupta-14 this looks good but the mouse control check not work in scenarios though. Like for example a tablet with some keyboard. Probably need a better check, instead of this.

@ShivaGupta-14
Copy link
Contributor Author

thanks @its-me-abhishek! you are right it needs a better check. I researched this and I am planning to use the Active Context approach combined with the current implementation, so it will work on both touch/keyboard devices and with mouse hover.

will push the update soon!

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.

bug: hotkeysEnabled state is set but never checked before executing hotkeys

2 participants