Skip to content

Handle Escape for active annotation tools#21375

Open
KirtiRamchandani wants to merge 1 commit into
mozilla:masterfrom
KirtiRamchandani:fix/escape-deselect-annotation-tool
Open

Handle Escape for active annotation tools#21375
KirtiRamchandani wants to merge 1 commit into
mozilla:masterfrom
KirtiRamchandani:fix/escape-deselect-annotation-tool

Conversation

@KirtiRamchandani
Copy link
Copy Markdown

Problem

  • The annotation toolbar can be enabled from the keyboard/mouse, but pressing Escape only unselects existing editors and does not turn off the active tool when no editor is selected.

Root cause

  • The editor keyboard manager handles Escape for selected or active editors, but there was no Escape path for the active tool mode itself.

Solution

  • When an annotation editor mode is active and there is no active editor, selection, or drawing session to handle, Escape switches the editor mode back to none.
  • Added integration coverage for the FreeText toolbar state and viewer mode after Escape.

Tests run

  • npx prettier --check src/display/editor/tools.js test/integration/freetext_editor_spec.mjs
  • npx eslint src/display/editor/tools.js test/integration/freetext_editor_spec.mjs --report-unused-disable-directives
  • git diff --check
  • npx gulp generic
  • Focused browser smoke test against the built generic viewer for Escape deselecting the active FreeText tool

Fixes #20199

@timvandermeij timvandermeij requested a review from calixteman June 2, 2026 18:02
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.45%. Comparing base (5fbab91) to head (267313f).
⚠️ Report is 12 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21375      +/-   ##
==========================================
- Coverage   81.45%   81.45%   -0.01%     
==========================================
  Files         260      260              
  Lines       65805    65809       +4     
==========================================
+ Hits        53600    53602       +2     
- Misses      12205    12207       +2     
Flag Coverage Δ
fonttest 9.06% <ø> (ø)
integrationtest 66.73% <100.00%> (-0.02%) ⬇️
unittest 57.04% <0.00%> (+<0.01%) ⬆️
unittestcli 55.99% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Press 'ESC' to deselect annotation tool.

3 participants