From 1f3b6cafd31496f7f8f9c33a272326556641e8b9 Mon Sep 17 00:00:00 2001 From: "Nick T." <73005126+tiliakoos@users.noreply.github.com> Date: Mon, 23 Nov 2026 12:39:31 -0500 Subject: [PATCH] fix(desktop): swiping sideways over a confirmation dialog no longer goes back or forward Base UI AlertDialog renders role="alertdialog" rather than role="dialog", so lockSwipeAxis did not ignore horizontal trackpad swipes over confirmation dialogs. Co-authored-by: only21mil <263261067+only21mil@users.noreply.github.com> --- apps/web/src/components/HistorySwipeNavigation.browser.test.tsx | 2 ++ apps/web/src/components/HistorySwipeNavigation.tsx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/HistorySwipeNavigation.browser.test.tsx b/apps/web/src/components/HistorySwipeNavigation.browser.test.tsx index d36efc1d535d..eac434010492 100644 --- a/apps/web/src/components/HistorySwipeNavigation.browser.test.tsx +++ b/apps/web/src/components/HistorySwipeNavigation.browser.test.tsx @@ -39,6 +39,7 @@ describe("HistorySwipeNavigation", () => { ["scrolling over a streamed preview keeps the thread", "server-browser", 0, -130, false], ["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], + ["swiping back over an open alert dialog keeps the thread", "alertdialog", 0, -130, false], ] as const)("%s", async (_name, scroller, scrollLeft, deltaX, navigates) => { navigateHistory.mockReset(); using _platform = vi.spyOn(navigator, "platform", "get").mockReturnValue("MacIntel"); @@ -50,6 +51,7 @@ describe("HistorySwipeNavigation", () => { if (scroller === "preview-panel") panel.setAttribute("data-preview-panel-mode", "inline"); if (scroller === "preview-viewport") panel.setAttribute("data-preview-viewport", "tab"); if (scroller === "server-browser") panel.setAttribute("data-server-browser-surface", "tab"); + if (scroller === "alertdialog") panel.setAttribute("role", "alertdialog"); viewport.style.cssText = `width: 200px; overflow-x: ${noOverflow ? "visible" : "auto"}`; const content = viewport.appendChild(document.createElement("div")); content.style.cssText = `height: 20px; width: ${noOverflow ? 100 : 1000}px`; diff --git a/apps/web/src/components/HistorySwipeNavigation.tsx b/apps/web/src/components/HistorySwipeNavigation.tsx index 09b363c2d1f7..537cdcd57afc 100644 --- a/apps/web/src/components/HistorySwipeNavigation.tsx +++ b/apps/web/src/components/HistorySwipeNavigation.tsx @@ -73,7 +73,7 @@ function lockSwipeAxis( (node) => node instanceof Element && node.matches( - '[role="dialog"], [data-preview-panel-mode], [data-preview-viewport], [data-server-browser-surface]', + '[role="dialog"], [role="alertdialog"], [data-preview-panel-mode], [data-preview-viewport], [data-server-browser-surface]', ), ) ) {