# Text selection highlight misalignment during zoom operations

**URL:** <https://pdfjs.community/t/text-selection-highlight-misalignment-during-zoom-operations/3648>\
**Category:** Bug Reports\
**Tags:** pdfjs-express\
**Created:** [March 21, 2025, 8:15am UTC](https://pdfjs.community/t/text-selection-highlight-misalignment-during-zoom-operations/3648 "2025-03-21T08:15:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![harald](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/harald/32/2108_2.png) [@harald](https://pdfjs.community/u/harald)\
**Post date:** [March 21, 2025, 8:15am UTC](https://pdfjs.community/t/text-selection-highlight-misalignment-during-zoom-operations/3648/1 "2025-03-21T08:15:16Z")

</div>

**Which product are you using?**  
PDF.js Express Viewer v8.7.5

**Detailed description of issue**  
When zooming in and out after selecting text in the document viewer, the highlight layer becomes misaligned with the underlying text. This issue can appear after just a few zoom actions or may require more extensive zooming to reproduce.

**Steps to Reproduce**

1. Open the document in the public demo viewer.
2. Select a portion of text.
3. Use the zoom in/out functionality several times.
4. Observe that the text selection highlight no longer aligns correctly with the text.

**Expected Result**  
The selected text highlight should remain aligned with the text regardless of zoom level.

**Actual Result**  
The highlight layer shifts position, causing the visible selection to move out of sync with the text.

**Does your issue happen with every document, or just one?**  
Every document

Please investigate and advise on a fix to keep the selection layer aligned during zoom operations.

A screen recording is attached for reference.  
 ![Kapture 2025-03-21 at 09.03.57](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/7/74c1759771de966c1fc722fbf4e21938891131bf.gif)

---

<div class="post-metadata">

**Author:** ![kkim](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kkim](https://pdfjs.community/u/kkim)\
**Post date:** [March 21, 2025, 4:56pm UTC](https://pdfjs.community/t/text-selection-highlight-misalignment-during-zoom-operations/3648/3 "2025-03-21T16:56:03Z")

</div>

Hi there,

I am unable to reproduce the issue as shown in your video, could you please try reproducing it in the plus viewer?

best regards,  
Kevin

---

<div class="post-metadata">

**Author:** ![harald](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/harald/32/2108_2.png) [@harald](https://pdfjs.community/u/harald)\
**Post date:** [March 24, 2025, 11:45am UTC](https://pdfjs.community/t/text-selection-highlight-misalignment-during-zoom-operations/3648/4 "2025-03-24T11:45:24Z")

</div>

Its quite easy to reproduce in the free viewer (just zoom quickly in and out a couple of times with an active selection). I did not manage to reproduce in the plus version.

---

<div class="post-metadata">

**Author:** ![kkim](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kkim](https://pdfjs.community/u/kkim)\
**Post date:** [March 24, 2025, 7:21pm UTC](https://pdfjs.community/t/text-selection-highlight-misalignment-during-zoom-operations/3648/5 "2025-03-24T19:21:34Z")

</div>

Thank you for reporting this, I will add this to the backlog for the product team to review.

Best regards,  
Kevin
