Skip to content

fix(Tasks): implement hotkeysEnabled state to control keyboard shortcuts#426

Open
ShivaGupta-14 wants to merge 1 commit intoCCExtractor:mainfrom
ShivaGupta-14:fix/425-hotkeys-hover-control
Open

fix(Tasks): implement hotkeysEnabled state to control keyboard shortcuts#426
ShivaGupta-14 wants to merge 1 commit intoCCExtractor:mainfrom
ShivaGupta-14:fix/425-hotkeys-hover-control

Conversation

@ShivaGupta-14
Copy link
Contributor

@ShivaGupta-14 ShivaGupta-14 commented Jan 21, 2026

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

  • Add active context pattern with onPointerDown for tablet/touch support

  • Add global pointerdown listener to disable hotkeys on outside click

  • Add tests for active context scenarios

  • 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

@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!

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!

@ShivaGupta-14 ShivaGupta-14 force-pushed the fix/425-hotkeys-hover-control branch from 7d0605a to d82cb88 Compare January 24, 2026 09:04
@ShivaGupta-14
Copy link
Contributor Author

pushed the updated changes! now hotkeys work for mouse hover, clicks, taps, and stylus input

@its-me-abhishek
Copy link
Collaborator

I think just having an active context should suffice for this, not sure though

@ShivaGupta-14
Copy link
Contributor Author

for task management apps, hover is the standard UX, users don't context-switch like in VS Code, so i think it's better to keep it.

@ShivaGupta-14 ShivaGupta-14 force-pushed the fix/425-hotkeys-hover-control branch 2 times, most recently from 3113ea5 to 5a80ce2 Compare February 1, 2026 16:42
- 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
- Add active context pattern with `onPointerDown` for tablet/touch support
- Add global pointerdown listener to disable hotkeys on outside click
- Add tests for active context scenarios
- Add helper.ts to reduce redundant hotkey setup in tests
@ShivaGupta-14 ShivaGupta-14 force-pushed the fix/425-hotkeys-hover-control branch from 5a80ce2 to 57351ea Compare February 1, 2026 16:46
Copy link
Collaborator

@its-me-abhishek its-me-abhishek left a comment

Choose a reason for hiding this comment

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

This looks fine but since we already have too many states and useEffects already, I guess we should avoid adding more of them to maintain.

The Intersection Observer API is a better fix (either globally or locally) for this issue, and this package provides that. This solution might be a bit better, and well tested, as compared to this, as the current approach requires some testing and might break on some devices. Can close the PR for now if required.

@ShivaGupta-14
Copy link
Contributor Author

ShivaGupta-14 commented Feb 4, 2026

Hi @its-me-abhishek,

Thanks for the suggestion about using Intersection Observer and the package! I did some research on it and found that it detects visibility (whether an element is on screen) rather than user interaction (hover/click).

while this might work fro our current setup with mainly the Tasks table, it could create conflicts when we add the planned features like Kanban, Calendar, and Graph views, since multiple views could be visible simultaneously, causing hotkey conflicts.

regarding device compatibility concerns you mentioned, the current implementation uses pointer events which are well-supported across desktop, mobile, tablets, and stylus devices.

I completely understand your concern about too many states and useEffects in Tasks.tsx, as a solution, I can refactor the current implementation into a reusable useHotkeyScope custom hook. This would:

  • reduce the state/effect count in Tasks.tsx
  • make it reusable for future views (knban, calendar, graph)
  • Keep the logic centralized in one place

would that work better? happy to discuss alternatives if you have other ideas!

Thanks!

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