The issue
When the target element is in a scrollable area and is overflowing, the highlight does not take into account that a part of the element is not visible. The popover position alsodoes not go outside the scrollable parent even if there is available space.
Issue demonstrated in Stackblitz: https://stackblitz.com/edit/shepherd-target-scrollable?file=index.html

Proposed solution for highlight overflowing
On show of the step we can get the scrollable parent if there is one:
function getScrollParent(element: HTMLElement): HTMLElement {
if (!element) {
return null;
}
const overflowY = window.getComputedStyle(element).overflowY;
const isScrollable = overflowY !== 'hidden' && overflowY !== 'visible';
if (isScrollable && element.scrollHeight >= element.clientHeight) {
return element;
}
return getScrollParent(element.parentElement) || document.body;
}
Then in the render loop in shepherd-modal.svelte we can compare the scroll parent's position and our target position like so:
function getVisibleHeight(element: HTMLElement, scrollParent: HTMLElement): {top: number, height: number} {
const elementTop = element.getBoundingClientRect().top;
const elementBottom = element.getBoundingClientRect().bottom;
const scrollTop = scrollParent.getBoundingClientRect().top;
const scrollBottom = scrollParent.getBoundingClientRect().bottom;
const top = Math.max(elementTop, scrollTop);
const bottom = Math.min(elementBottom, scrollBottom);
const height = bottom - top;
return {top, height};
}
For a horisontal scroll the implementation should be analogous. I can open a PR about this in the coming days.
Popover position
This might be an issue in the popper library. Will Tether handle this use case correctly? Is there a solution for this issue in the meantime?
The issue
When the target element is in a scrollable area and is overflowing, the highlight does not take into account that a part of the element is not visible. The popover position alsodoes not go outside the scrollable parent even if there is available space.
Issue demonstrated in Stackblitz: https://stackblitz.com/edit/shepherd-target-scrollable?file=index.html

Proposed solution for highlight overflowing
On show of the step we can get the scrollable parent if there is one:
Then in the render loop in
shepherd-modal.sveltewe can compare the scroll parent's position and our target position like so:For a horisontal scroll the implementation should be analogous. I can open a PR about this in the coming days.
Popover position
This might be an issue in the popper library. Will Tether handle this use case correctly? Is there a solution for this issue in the meantime?