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

Enable selecting the text underneath annotations #906

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

allanlasser
Copy link
Member

@allanlasser allanlasser commented Nov 27, 2024

Fixes #778

This is a complex interaction achieved with little DOM trickery.

First, it sets pointer-events: none on the highlight element to allow users to select the text that's been highlighted.

Then, it listens for clicks on the page and compares the click coordinates with the coordinates of highlights on the page. If the click is within the highlight's bounds, it will dispatch a click on the highlight to open the note.

As a side-effect, we can now support overlapping highlights! However, we only support a single note in our $currentNote store, so for now the last highlight that calls click will be the note that appears. I've captured this as #907. (One issue closed, another opened; so it goes.)

Copy link

netlify bot commented Nov 27, 2024

Deploy Preview for documentcloud-frontend-next ready!

Name Link
🔨 Latest commit 9fe8139
🔍 Latest deploy log https://app.netlify.com/sites/documentcloud-frontend-next/deploys/67476d694521d70008c72310
😎 Deploy Preview https://deploy-preview-906.muckcloud.com
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 26 (🔴 down 32 from production)
Accessibility: 86 (🟢 up 1 from production)
Best Practices: 83 (🔴 down 9 from production)
SEO: 82 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 30.81% 6724 / 21822
🔵 Statements 30.81% 6724 / 21822
🔵 Functions 49.63% 275 / 554
🔵 Branches 75.14% 1013 / 1348
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/lib/components/viewer/AnnotationLayer.svelte 0% 0% 0% 0% 1-279
src/lib/components/viewer/PDFPage.svelte 0% 0% 0% 0% 1-282
Generated in workflow #398 for commit 9fe8139 by the Vitest Coverage Report Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable selecting the text underneath annotations
1 participant