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

Text selection results in gray overlay #1925

Closed
4 tasks done
razh opened this issue Dec 19, 2024 · 2 comments
Closed
4 tasks done

Text selection results in gray overlay #1925

razh opened this issue Dec 19, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@razh
Copy link

razh commented Dec 19, 2024

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

The CSS added in #1880 results in a gray overlay whenever text is selected:

diff --git a/packages/react-pdf/src/Page/TextLayer.css b/packages/react-pdf/src/Page/TextLayer.css
index 727c21127..094eff504 100644
--- a/packages/react-pdf/src/Page/TextLayer.css
+++ b/packages/react-pdf/src/Page/TextLayer.css
@@ -105,8 +105,9 @@
   user-select: none;
 }
 
-.textLayer .endOfContent.active {
+.textLayer.selecting .endOfContent {
   top: 0;
+  background: gray;
 }
 
 .hiddenCanvasElement {

https://github.com/wojtekmaj/react-pdf/pull/1880/files#diff-44343a2a08329e0e1279454e436a982253618ee02b740f26dfe07e21c3c7b3db

Steps to reproduce

  1. Run yarn dev
  2. Select a PDF.
  3. Attempt to select text.
Before selecting text After selecting text
CleanShot 2024-12-19 at 16 15 28@2x CleanShot 2024-12-19 at 16 15 42@2x

Expected behavior

No gray overlay.

Actual behavior

.endOfContent appears to cover the entire PDF with a gray background.

Additional information

No response

Environment

  • Browser (if applicable):
  • React-PDF version: 9.2.0
  • React version:
  • Bundler name and version (if applicable):
@razh razh added the bug Something isn't working label Dec 19, 2024
@landegt
Copy link

landegt commented Dec 19, 2024

Can confirm this issue with react-pdf@9.2.0. The .endOfContent div expands to cover the entire document with a gray background during text selection.

@wojtekmaj
Copy link
Owner

Thanks, fixed in 9.2.1!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants