Skip to content

Navigate to the page of an ink annotation when its deletion is undone - #22159

Open
LoukasPap wants to merge 1 commit into
mozilla:masterfrom
LoukasPap:fix/ink-undo-navigation
Open

LoukasPap wants to merge 1 commit into
mozilla:masterfrom
LoukasPap:fix/ink-undo-navigation

Conversation

@LoukasPap

@LoukasPap LoukasPap commented Oct 12, 2026 •

Copy link
Copy Markdown

When a highlight or a comment is deleted and the deletion is undone, the viewer navigates to the page of the restored element. This didn't happen for an ink annotation.

The other editors (highlight, stamp, FreeText) call div.focus() in onceAdded when they're added back, which scrolls their page into view. DrawingEditor.onceAdded only focused the editor when it had to be committed (i.e. a freshly drawn stroke), so a restored ink was silently put back where it was.

The fix scrolls the restored editor into view. Focusing it instead isn't an option here since it would also select it, and undoing the deletion of several inks must leave none of them selected.

Test cases

  1. Open comments.pdf.
  2. Switch to the ink tool and scroll to page 5.
  3. Select the ink annotation and delete it.
  4. Scroll to page 7 and check that the current page is 7.
  5. Undo the deletion.
  6. Check that the viewer navigates back to page 5.

@LoukasPap LoukasPap changed the title [Editor] Navigate to the page of an ink annotation when its deletion is undone Navigate to the page of an ink annotation when its deletion is undone Oct 12, 2026
@LoukasPap
LoukasPap marked this pull request as ready for review October 12, 2026 15:10
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Viewer preview

Commit 0c5cf0c (build logs).

Viewer Build Preview
Modern (gulp generic) ✅ not published
Legacy (gulp generic-legacy) ✅ not published

🔒 A user with write access must approve this commit with the viewer-preview label to publish the viewers.

@codecov-commenter

codecov-commenter commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.32%. Comparing base (68f5e21) to head (0c5cf0c).
⚠️ Report is 546 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #22159      +/-   ##
==========================================
+ Coverage   90.30%   90.32%   +0.02%     
==========================================
  Files         277      277              
  Lines       67956    68006      +50     
==========================================
+ Hits        61367    61427      +60     
+ Misses       6589     6579      -10     
Flag Coverage Δ
browsertest 66.20% <0.00%> (-0.04%) ⬇️
fonttest 8.98% <ø> (ø)
integrationtest 69.36% <100.00%> (+0.08%) ⬆️
unittest 60.41% <0.00%> (+0.21%) ⬆️
unittestcli 58.35% <0.00%> (+0.04%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

@LoukasPap
LoukasPap marked this pull request as draft October 12, 2026 21:14
Highlights, stamps and FreeText editors take the focus when they're added
back, which scrolls their page into view. Ink editors only did that when
they had to be committed, so undoing the deletion of an existing ink
didn't navigate to it.

Scroll the restored ink into view rather than focusing it: focusing also
selects the editor, and undoing the deletion of several inks must not
leave any of them selected.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@LoukasPap
LoukasPap force-pushed the fix/ink-undo-navigation branch from 687da22 to 0c5cf0c Compare October 12, 2026 21:39
@LoukasPap

Copy link
Copy Markdown
Author

Test case must draw, undo a deletion and check that the editors are not selected now passes.

@LoukasPap
LoukasPap marked this pull request as ready for review October 12, 2026 21:43

This branch has not been deployed

No deployments
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.

3 participants