Skip to content

Commit ed0a658

Browse files
fix(ui): Hide timelineCursor when obscured by a overlay element (#91842)
Fixes issues like this <img alt="clipboard.png" width="459" src="https://i.imgur.com/70hcaeL.png" /> ![clipboard.png](https://i.imgur.com/bWl5iq8.png)
1 parent 3c81588 commit ed0a658

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

static/app/components/checkInTimeline/timelineCursor.spec.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ function TestComponent() {
2424
}
2525

2626
describe('TimelineCursor', function () {
27+
beforeEach(() => {
28+
document.elementsFromPoint = () => [];
29+
});
30+
2731
it('renders', async function () {
2832
render(<TestComponent />);
2933

static/app/components/checkInTimeline/timelineCursor.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,16 @@ function useTimelineCursor<E extends HTMLElement>({
6565
// within the containerRect. This proves to be less glitchy as some
6666
// elements within the container may trigger an onMouseLeave even when
6767
// the mouse is still "inside" of the container
68+
//
69+
// Also tests that the mouse is not obscured by a overlay element.
6870
const isInsideContainer =
6971
e.clientX > containerRect.left &&
7072
e.clientX < containerRect.right &&
7173
e.clientY > containerRect.top &&
72-
e.clientY < containerRect.bottom;
74+
e.clientY < containerRect.bottom &&
75+
!document
76+
.elementsFromPoint(e.clientX, e.clientY)
77+
.some(el => el.hasAttribute('data-overlay'));
7378

7479
if (isInsideContainer !== isVisible) {
7580
setIsVisible(isInsideContainer);

0 commit comments

Comments
 (0)