Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced Text selection doesn't work as it does in pdf.js #1034

Closed
4 tasks done
yuvalyellin opened this issue Aug 1, 2022 · 1 comment
Closed
4 tasks done

Enhanced Text selection doesn't work as it does in pdf.js #1034

yuvalyellin opened this issue Aug 1, 2022 · 1 comment
Labels
enhancement New feature or request fresh

Comments

@yuvalyellin
Copy link

Before you start - checklist

  • I followed instructions in documentation written for my React-PDF version
  • I have checked if this bug is not already reported
  • I have checked if an issue is not listed in Known issues
  • If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo

Description

In PDF.js text selection works more smoothly than in react-pdf for my pdf (in Chrome)
I added a border to border to .textLayer span, and it seems like in pdf.js they pad text spans so they run into each other, making selection less jumpy, while in react-pdf when the mouse is over white spaces between elements selection behaves erraticaly.
The relevant code is in https://github.com/mozilla/pdf.js/blob/26ae50e4494aa57b31f305df759fb44ae8be4cd7/web/text_layer_builder.js , they call expandTextDivs onMouseDown. (when using enhanceTextSelection )
Can this be added to react-pdf?

Thanks,
Yuval

Steps to reproduce

Open a pdf in react-pdf in Chrome
Select a text hovering on white spaces between lines/ over edges

Expected behavior

Selection should run smoothly

Actual behavior

selection jumps to end/start of page / paragraph

Additional information

No response

Environment

  • Browser (if applicable): Chrome 103
  • React-PDF version: ^6.0.0-beta.3
  • React version: 18.2.0
  • Webpack version (if applicable): 5
@yuvalyellin yuvalyellin added the bug Something isn't working label Aug 1, 2022
@github-actions
Copy link
Contributor

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 14 days.

@github-actions github-actions bot added the stale label Oct 31, 2022
@wojtekmaj wojtekmaj added enhancement New feature or request fresh and removed bug Something isn't working stale labels Nov 4, 2022
wojtekmaj added a commit that referenced this issue Nov 15, 2022
Adds an element behind text items that expands on mouse down. This especially improves text selection behavior on Firefox where elements with user-select: none prevent selection from being updated.

Closes #1034
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fresh
Projects
None yet
Development

No branches or pull requests

2 participants