Skip to content

Fix the comment button color of newly created highlights in the annotation layer - #22089

Open
LoukasPap wants to merge 1 commit into
mozilla:masterfrom
LoukasPap:fix/false-new-comment-annotation-color
Open

LoukasPap wants to merge 1 commit into
mozilla:masterfrom
LoukasPap:fix/false-new-comment-annotation-color

Conversation

@LoukasPap

Copy link
Copy Markdown

Fixes #22087

When a highlight with a comment is created and the highlight tool is closed, the comment button rendered in the annotation layer was gray instead of using the highlight's color. PopupElement.#updateColor returned early for any element with an extra popup element, which is always the case for the editor-backed annotation created for a new highlight, so no background-color was ever set. The update is now only skipped when there is no associated editor, mirroring the check already done in #updateCommentButtonPosition.

An integration test is added in test/integration/comment_spec.mjs.

Test cases

Test 1: The comment button keeps the highlight color after closing the highlight tool

  1. Open any PDF with text, with comments enabled.
  2. Select some text and click the comment button of the floating toolbar.
  3. Type a comment and save it.
  4. Select the red highlight color.
  5. Close the highlight tool.
  6. The comment button is red (it was gray before).

…ation layer

When a highlight with a comment is created, the comment button rendered in
the annotation layer didn't get any background color, because
`PopupElement.#updateColor` bailed out for any element having an extra popup
element, which is always the case for editor-backed annotations.
Only skip the update when there's no associated editor, as already done in
`#updateCommentButtonPosition`.

Fixes mozilla#22087

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@calixteman calixteman added the viewer-preview Publish the viewer preview of this commit label Oct 6, 2026
@github-actions github-actions Bot removed the viewer-preview Publish the viewer preview of this commit label Oct 6, 2026
@codecov-commenter

codecov-commenter commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.27%. Comparing base (17bb244) to head (1e4d6fc).
⚠️ Report is 27 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #22089      +/-   ##
==========================================
- Coverage   90.30%   90.27%   -0.03%     
==========================================
  Files         269      269              
  Lines       67362    67362              
==========================================
- Hits        60828    60813      -15     
- Misses       6534     6549      +15     
Flag Coverage Δ
browsertest 66.06% <0.00%> (-0.01%) ⬇️
fonttest 8.95% <ø> (ø)
integrationtest 69.22% <100.00%> (-0.02%) ⬇️
unittest 59.86% <0.00%> (-0.02%) ⬇️
unittestcli 58.39% <0.00%> (-0.02%) ⬇️

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.

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.

[Bug]: False color of annotationCommentButton when created

4 participants