Skip to content

Comments

fix: issue1, issue2 and issu3#7509

Merged
santicomp2014 merged 3 commits intomainfrom
fix-vpat-keyboard
Feb 24, 2026
Merged

fix: issue1, issue2 and issu3#7509
santicomp2014 merged 3 commits intomainfrom
fix-vpat-keyboard

Conversation

@gmorador-tribu
Copy link

@gmorador-tribu gmorador-tribu commented Feb 18, 2026

This pull request improves the keyboard and mouse interaction logic for drawing rectangles in the annotation tool, clarifying the behavior when switching between input methods and updating keyboard shortcut conventions. It also adds new tests to ensure correct handling of keyboard-initiated rectangles.

https://github.com/orgs/hypothesis/projects/157/views/1?pane=issue&itemId=157872970
https://github.com/orgs/hypothesis/projects/157/views/1?pane=issue&itemId=157874357
https://github.com/orgs/hypothesis/projects/157/views/1?pane=issue&itemId=157876244

Keyboard and Mouse Interaction Improvements:

  • Introduced a _rectInitiatedByKeyboard flag in DrawTool to track when a rectangle is created using the keyboard, and updated logic so that the first mouse move after keyboard initiation clears the rectangle and deactivates keyboard mode, allowing the user to seamlessly switch to mouse drawing. [1] [2] [3] [4] [5]
  • Ensured that keyboard mode is reset and the rectangle state is properly cleared after cancellation or mouse interaction.

Keyboard Shortcut Updates:

  • Changed the "large increment" for keyboard movement (when moving shapes with arrow keys) from using Shift to using Ctrl or Cmd, updating both implementation and documentation/comments. [1] [2]
  • Updated related test descriptions and logic to reflect the switch from Shift to Ctrl for large increments. [1] [2]

Sidebar and Annotation Creation Behavior:

  • Modified annotation creation via the sidebar so that, when creating a rectangle annotation with the mouse, the tool defaults to 'move' mode unless a keyboard mode is already set, ensuring the rectangle appears on the canvas as expected. [1] [2]

Testing Enhancements:

  • Added a comprehensive test to verify that a keyboard-initiated rectangle is cleared on the first mouse move, keyboard mode is deactivated, and subsequent mouse drawing works as intended.

@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.61%. Comparing base (bf7b6d5) to head (f0cdabb).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7509   +/-   ##
=======================================
  Coverage   99.61%   99.61%           
=======================================
  Files         283      283           
  Lines       11861    11877   +16     
  Branches     2895     2898    +3     
=======================================
+ Hits        11815    11831   +16     
  Misses         46       46           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates DrawTool’s keyboard interaction behavior and attempts to improve rectangle initialization when creating rect annotations, along with corresponding test updates.

Changes:

  • Switch “large increment” arrow-key movement modifier from Shift to Ctrl/Cmd.
  • Default rect annotations to start in keyboard “move” mode when no pending keyboard mode is set.
  • Add logic to clear a keyboard-initialized rectangle when the user starts moving the mouse.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/annotator/test/draw-tool-test.js Updates keyboard movement tests to use Ctrl instead of Shift for large increments.
src/annotator/guest.ts Changes how initialMode is chosen when starting drawing for rect annotations.
src/annotator/draw-tool.tsx Updates large-increment modifier handling and adds “keyboard-initiated rect” state/behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@santicomp2014 santicomp2014 left a comment

Choose a reason for hiding this comment

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

Approved, this fixes the issues 1,2,3 for VPAT

@santicomp2014 santicomp2014 merged commit b07c1b8 into main Feb 24, 2026
4 checks passed
@santicomp2014 santicomp2014 deleted the fix-vpat-keyboard branch February 24, 2026 13:57
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