Skip to content

Fix the z-order of ink drawings relative to the other editors#21608

Open
mughalfrazk wants to merge 1 commit into
mozilla:masterfrom
mughalfrazk:bug-21401-annotation-editor-z-order
Open

Fix the z-order of ink drawings relative to the other editors#21608
mughalfrazk wants to merge 1 commit into
mozilla:masterfrom
mughalfrazk:bug-21401-annotation-editor-z-order

Conversation

@mughalfrazk

Copy link
Copy Markdown

When an ink drawing and an image/stamp overlap, the editor always painted the image on top, whatever order they were created in. Saving and reopening the PDF showed the correct order, so the preview didn't match the final rendering.

The drawings are SVGs living in the canvas wrapper, whereas the other editors are divs living in the annotation editor layer. Both layers are siblings in the page and neither creates a stacking context, so their children compete directly, and the SVGs had no z-index at all.

The SVGs now carry the z-index of the editor they belong to, both when they're created and when it changes. The in-progress drawing uses the z-index its editor will be given once the drawing session ends, so that the stroke doesn't jump when the pointer is released.

Since the SVGs are now stacked with the editors, they're also hit-tested before the annotation editor layer, so they must not swallow the pointer events used to draw: they're purely visual, the editor div being what handles the interactions.

Fixes #21401.

@timvandermeij
timvandermeij requested a review from calixteman July 21, 2026 18:18
@codecov-commenter

codecov-commenter commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.84%. Comparing base (d314788) to head (2acada9).
⚠️ Report is 15 commits behind head on master.

Files with missing lines Patch % Lines
src/display/editor/draw.js 76.92% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21608      +/-   ##
==========================================
- Coverage   89.84%   89.84%   -0.01%     
==========================================
  Files         263      263              
  Lines       66772    66786      +14     
==========================================
+ Hits        59993    60005      +12     
- Misses       6779     6781       +2     
Flag Coverage Δ
browsertest 66.54% <0.00%> (-0.02%) ⬇️
fonttest 9.05% <ø> (ø)
integrationtest 69.26% <82.35%> (+<0.01%) ⬆️
unittest 57.46% <0.00%> (-0.04%) ⬇️
unittestcli 56.45% <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 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.

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.

[Bug]: Annotation editor preview does not match the final rendered PDF

3 participants