Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions apps/app/src/components/ui/scroll-position-keeper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,32 @@ describe("ScrollPositionKeeper", () => {
expect(timeline.layout.scrollTop).toBe(timeline.layout.maxScrollTop());
});

it("follows a scroll without input while the pointer is over an embedded frame, whose wheel events the timeline never receives", () => {
const timeline = createTimeline(rowsOf(10), { attached: true });
const frame = document.createElement("iframe");
timeline.element("row-9").append(frame);

frame.dispatchEvent(new MouseEvent("mouseover", { bubbles: true }));
timeline.layout.layoutScrollTo(timeline.layout.scrollTop - 300);
expect(timeline.keeper.isAttached()).toBe(false);
expect(timeline.layout.scrollTop).toBe(
timeline.layout.maxScrollTop() - 300,
);
});

it("keeps the end again once a hovered frame leaves the timeline, even before the pointer moves", () => {
const timeline = createTimeline(rowsOf(10), { attached: true });
const frame = document.createElement("iframe");
timeline.element("row-9").append(frame);

frame.dispatchEvent(new MouseEvent("mouseover", { bubbles: true }));
frame.remove();
timeline.layout.layoutScrollTo(timeline.layout.scrollTop - 300);

expect(timeline.keeper.isAttached()).toBe(true);
expect(timeline.layout.scrollTop).toBe(timeline.layout.maxScrollTop());
});

it("follows a focus move after Tab as the reader's scroll", () => {
const timeline = createTimeline(rowsOf(10), { attached: true });

Expand Down
3 changes: 2 additions & 1 deletion apps/app/src/components/ui/scroll-position-keeper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,8 @@ export class ScrollPositionKeeper {
private followsUnexplainedScroll(): boolean {
return (
this.windowFindOpen ||
(this.position.kind !== "bottom" && this.pendingRestore === null)
(this.position.kind !== "bottom" && this.pendingRestore === null) ||
this.options.getScrollElement()?.querySelector("iframe:hover") != null
);
}

Expand Down
Loading