Skip to content

Freezes when showing/hiding popover when many annotations overlap #520

@wjt

Description

@wjt

In an application I'm working on which uses Annotator, it's common to have many intersecting annotations for some piece of text. Mousing over that text often causes the page to freeze after the popover is first displayed. Here's an extreme example with 150 annotations for the same word – it is using annotator master, but I had the same problem with 1.2.x.

What seems to be happening is: there are many nested <span class="annotator-hl"> elements surrounding the text in question. Mousing over the word triggers Viewer._onHighlightMouseover once for each span; the done callback for the hide timer fires many times, repeatedly re-drawing the same popover. checkOrientation shows up very prominently in a profile, but I feel like the real problem is doing the same work 150 times, not that the work itself is expensive!

I'm working around this in my app by just adding event.stopPropagation() to the mouseover callback (PR to follow) but I don't think that's a viable solution in general: if the page being annotated has its own mouseover behaviours, they'd be broken. (In my case, I control the page, so it's not a problem.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions