Skip to content

Overlay path covering element to highlight when outside of the initial window #1984

Description

@cmazereau

When an element to highlight is outside of the initial window (and needs to be scrolled to), the overlay covers this element.

It appears that the svg path of the overlay is calculated using _getVisibleHeight(), which returns 0 in that case.
This seems to be due to the fact that _getVisibleHeight() uses scrollParent.getBoundingClientRect(), without taking window.scrollY into account. The modification of _getVisibleHeight() as follow seems to resolve the issue :

  if (scrollParent) {
    const scrollRect = scrollParent.getBoundingClientRect();
    const scrollTop = scrollRect.y || scrollRect.top;
    const scrollBottom = scrollRect.bottom || scrollTop + scrollRect.height;
    top = Math.max(top, window.scrollY + scrollTop);
    bottom = Math.min(bottom, window.scrollY + scrollBottom);
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions