shipshapecode / shipshapecode/shepherd
Overlay path covering element to highlight when outside of the initial window
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13.8k
- Forks
- 658
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 15
Description
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);
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the implementation of _getVisibleHeight() and trace how its result is used to calculate the overlay SVG path. Reproduce a tour with a highlight target outside the initial window, then verify that scrolling the window leaves the target uncovered by the overlay.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100