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 is annotatable within nested not annotatable blocks #80

Closed
oleksandr-danylchenko opened this issue Mar 28, 2024 · 0 comments
Closed

Comments

@oleksandr-danylchenko
Copy link
Contributor

oleksandr-danylchenko commented Mar 28, 2024

Issue

Having the following layout, where the not-annotatable block contains another not-annotatable element can lead to an incorrect selection ranges split!

<div class="not-annotatable">
  <h3>Not annotatable block!</h3>
  <p>
    "See now, how men lay blame upon us gods for what is after all nothing but their own folly. Look at Aegisthus;
    he must needs make love to Agamemnon's wife unrighteously and then kill Agamemnon, though he knew it would be
    the <span class="not-annotatable">death of him; for I sent Mercury to warn him not</span> to do either of these things, inasmuch as Orestes would be
    sure to take his revenge when he grew up and wanted to return home. Mercury told him this in all good will but
    he would not listen, and now he has paid for everything in full."
  </p>
</div>
Screen.Recording.2024-03-28.at.22.16.35.mov

Essentially it's caused by a bug in the splitAnnotatableRanges method that doesn't exclude any nested not-annotatable from splits execution on them.

Therefore, the annotation continues after the nested not-annotatable element, within the not-annotatable element 🤪

The effect is better expressed if I apply the #67 PR, where I removed usage of the redundant trimRange method:
image

Possible Solution

Update the splitAnnotatableRanges to prevent iterations over any nested not-annotatable elements and splitting the ranges on them

rsimon added a commit that referenced this issue Mar 29, 2024
…tatable-selection

#80 Fixed annotating of the nested `not annotatable` content
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

No branches or pull requests

1 participant