Skip to content

hosting arrows in an arbitrary HTML element instead of document.body #49

@jan-dolejsi

Description

@jan-dolejsi

I see that all the examples host the arrow in the body.

document.body.appendChild(arrow.node);

It works well in simple web pages, but I run into issues in two scenarios:

  • in some more complex web page layouts (based on Material IO web components) the arrows initially paint with an offset and the user has to scroll the page a bit to get the arrows re-painted in the right position. While scrolling the page, the arrows jitter and lag behind the scrolling.
  • if the page is nested in an environment such as VS Code / Jupyter notebook visualization widget, the arrows do not show at all (perhaps there is a confusion about document.body, or the environment bans modifications of the body, not sure)

I tried to append the arrows to another element such as

document.getElementById('someContainerDivId').appendChild(arrow.node);

... but then the arrows did not show at all. No error in the console.

Can you see what happens if the arrows are added to an arbitrary div (let's say a div that contains the arrow start/end element)?
Otherwise the package is pretty awesome!

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