Skip to content

Conversation

@matt-atticus
Copy link

@matt-atticus matt-atticus commented Nov 26, 2025

Fixes an issue where highlighted search results interfere with text selection. From what we can tell, the issue stems from moving .endOfContent to the search highlight span, preventing the selection range from being extended.

Steps to reproduce the issue:

  1. Open the pdf.js demo viewer at https://mozilla.github.io/pdf.js/web/viewer.html
  2. Use the toolbar to search for a keyword e.g. "javascript"
  3. Try to create a text selection range that begins inside of, ends inside of, or spans the highlighted search result.
  4. Observe that individual characters in the search highlight cannot be smoothly selected/deselected via dragging.

The fix was tested on the demo viewer locally:

npx gulp dist-install && npx gulp server

# http://localhost:8888/web/viewer.html
pdfjs-highlight-fix.mov

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants