Skip to content

Drawing notation in wrong location #17

@0x213F

Description

@0x213F

Describe the bug
I am rendering multiple RoughNotation elements inline the same component. It looks something like this initially:

<div>
  <span>Hello, my name is </span>
  <RoughNotation className={styles.Notated}
                 show={true}
                 color="red"
                 type={modification.type}
                 animate={modification.animate}>
     0x213F
  </RoughNotation>
  <span>, nice to meet you!</span>
</div>

When the user interacts with the page, they can add more notations. For example, look at the following:

<div>
  <span>Hello, my </span>
  <RoughNotation show={true} color="red" type="highlight">
     name
  </RoughNotation>
  <span> is </span>
  <RoughNotation show={true} color="red" type="highlight">
     0x213F
  </RoughNotation>
  <span>, nice to meet you!</span>
</div>

When the new notation occurs before the already established notation, it renders fine (no bug). However, when it renders after, it does not render as expected:

<div>
  <span>Hello, my name is </span>
  <RoughNotation show={true} color="red" type="highlight">
     0x213F
  </RoughNotation>
  <span>, nice to </span>
  <RoughNotation show={true} color="red" type="highlight">
     meet
  </RoughNotation>
  <span> you!</span>
</div>

To Reproduce
Steps to reproduce the behavior:

  1. Render one Rough Notation inline
  2. Render a second Rough Notation inline, after the first one
  3. See error
  4. You may keep adding Rough Notations ahead of the last one to continue reproducing.

Expected behavior
(I was able to do this by "filling in" the Rough Notations backwards)

Screen Shot 2020-12-28 at 11 54 14 AM

Screenshots
("Filling in" the Rough Notation forwards, it highlights the first word 3 times in a row)

Screen Shot 2020-12-28 at 11 55 01 AM

Here is what the DOM looks like. I'm posting this as evidence that I didn't accidentally notate the same element 3 times, but instead did it to 3 different intervals.

Screen Shot 2020-12-28 at 12 04 10 PM

Desktop (please complete the following information):

  • OS: macOS
  • Browser Chrome
  • Version 87.0.4280.88

Additional context
Let me know how I can assist with this bug. I am having trouble understanding what the root cause may be. If someone could help point me in the right direction, that would be greatly appreciated!

If this ends up being a bug with a library, I would be happy to work on a PR if someone could give me more context on the fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions