Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): horizontal scrolling inside diff and file panes no longer switches threads #28091

MergedEtanHey(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/28091/headmerged by maria-rcks View on GitHub

Showing 2 changed files with 73 additions and 13 deletions.

x
0 of 2 viewed, 2 left
61 additions and 0 deletionsapps/web/src/components/HistorySwipeNavigation.browser.test.tsxAdded
View file
@@ -0,0 +1,61 @@
+import { describe, expect, it, vi } from "vite-plus/test";
+​
+import { render } from "../../test/render";
+import { HistorySwipeNavigation } from "./HistorySwipeNavigation";
+​
+const navigateHistory = vi.hoisted(() => vi.fn());
+vi.mock("../navigationHistory", () => ({ canNavigateHistory: () => true, navigateHistory }));
+​
+function swipe(target: Element, deltaX: number) {
+ for (const delta of [deltaX, 0]) {
+ target.dispatchEvent(new WheelEvent("wheel", { deltaX: delta, bubbles: true, composed: true }));
+ }
+}
+​
+describe("HistorySwipeNavigation", () => {
+ it.each([
+ ["scrolling left inside a shadow-root scroller keeps the thread", "shadow", 100, -130, false],
+ ["scrolling right inside a shadow-root scroller keeps the thread", "shadow", 100, 130, false],
+ [
+ "scrolling after a shadow scroller remount keeps the thread",
+ "shadow-remount",
+ 100,
+ 130,
+ false,
+ ],
+ ["scrolling left inside a scroller keeps the thread", "light", 100, -130, false],
+ ["swiping back at a shadow-root scroller's left edge navigates", "shadow", 0, -130, true],
+ ["swiping back over a panel without overflow navigates", "none", 0, -130, true],
+ ["a swipe that started in a closed dialog keeps the thread", "closed-dialog", 0, -130, false],
+ ] as const)("%s", async (_name, scroller, scrollLeft, deltaX, navigates) => {