-
Notifications
You must be signed in to change notification settings - Fork 194
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
Annotations immediately orphan when selecting text in a PDF that includes last character on page #1329
Comments
Also occurs here: https://hypothesis.zendesk.com/agent/tickets/5926 |
The immediate problem here is an upstream issue in the
There is a problem in (3) if the generated text position includes the final character of the text layer Although the basic problem is not actually specific to PDF annotation, it essentially never happens for HTML annotation because there are always some characters in an HTML document beyond what the user can actually select. With PDF annotation however, it is actually possible to select the last character in the text layer. I've submitted a PR and test cases upstream. Depending on how soon Randall is able to take a look and whether any further changes are needed, we'll either upgrade the library or temporarily use a fork. |
Address hypothesis/client#1329 and close #2.
Address hypothesis/client#1329 and close #2.
This currently fails to a bug on `dom-anchor-text-position`'s `toRange` implementation. See #1329
Add a new implementation of conversion from text positions (that is, offsets within an element's `textContent`) to DOM `Range`s along with test cases. This addresses an issue with the existing implementation of `toRange` in the `dom-anchor-text-position` package where conversion fails when the text position includes the end of the element's text. Even if/when the issue is addressed upstream, I think it would be useful to retain these test cases to guard against future regressions. See #1329
Change PDF anchoring to use the new text position => Range implementation from the `src/annotator/anchoring/text-position` module which fixes an issue when the last text in a PDF page is selected. Fixes #1329
Add a new implementation of conversion from text positions (that is, offsets within an element's `textContent`) to DOM `Range`s along with test cases. This addresses an issue with the existing implementation of `toRange` in the `dom-anchor-text-position` package where conversion fails when the text position includes the end of the element's text. Even if/when the issue is addressed upstream, I think it would be useful to retain these test cases to guard against future regressions. See #1329
Change PDF anchoring to use the new text position => Range implementation from the `src/annotator/anchoring/text-position` module which fixes an issue when the last text in a PDF page is selected. Fixes #1329
Address hypothesis/client#1329 and close #2.
Address hypothesis/client#1329 and close #2.
Address hypothesis/client#1329 and close #2.
This issue was created as part of investigating hypothesis/lms#875.
Steps to reproduce
Expected result: The selected text is highlighted and a new annotation appears in the "Annotations" tab in the client
Actual result: The selected text is not highlighted and the annotation appears in the "Orphans" tab in the client
After reloading the page, the annotation continues to be an orphan instead of anchoring.
Notes
The issue occurs whenever a selection to annotate matches these criteria:
div.textLayer
element that PDF.js creates for each page to enable text selection.The text was updated successfully, but these errors were encountered: