Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): trackpad swipe no longer switches threads after scrolling a code pane #39100

ClosedErnest0-Production(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/39100/headopened View on GitHub

Showing 2 changed files with 36 additions and 1 deletion.

x
0 of 2 viewed, 2 left
32 additions and 0 deletionsapps/web/src/components/HistorySwipeNavigation.browser.test.tsxModified
View file
@@ -60,6 +60,38 @@
expect(navigateHistory).toHaveBeenCalledTimes(navigates ? 1 : 0);
});
​
+ it.each([
+ [
+ "reversing over a scroller after swiping forward at its right edge keeps the thread",
+ 800,
+ [20, -50, 140],
+ ],
+ [
+ "reversing over a scroller after swiping back at its left edge keeps the thread",
+ 0,
+ [-20, 50, -140],
+ ],
+ ] as const)("%s", async (_name, scrollLeft, deltas) => {
+ navigateHistory.mockReset();
+ using _platform = vi.spyOn(navigator, "platform", "get").mockReturnValue("MacIntel");
+ await using screen = await render(<HistorySwipeNavigation />);
+ const viewport = screen.container.appendChild(document.createElement("div"));
+ viewport.style.cssText = "width: 200px; overflow-x: auto";
+ const content = viewport.appendChild(document.createElement("div"));
+ content.style.cssText = "height: 20px; width: 1000px";
+ viewport.scrollLeft = scrollLeft;
+ // Synthetic wheel events do not scroll natively.
+ viewport.addEventListener("wheel", (event) => {
+ viewport.scrollLeft += event.deltaX;
+ });
+​
+ for (const deltaX of [...deltas, 0]) {