Skip to content

Commit d504ec8

Browse files
authored
fix: DH-21539: Prevent browser back navigation on horizontal overscroll (#2654)
- Tested on mac, with the Code Studio app - Two finger scrolling the table does not trigger the Back gesture anymore - Also tested swiping from the edge of the trackpad, it also did not trigger Back
1 parent e858b42 commit d504ec8

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

packages/code-studio/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html lang="en">
2+
<html lang="en" style="overscroll-behavior: none">
33
<head>
44
<base href="%BASE_URL%" />
55
<meta name="ui-version" content="v%npm_package_version%" />

tests/table-scroll.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,18 @@ test('stuck to bottom scroll shrinking and growing table', async ({ page }) => {
208208
await page.waitForTimeout(2000);
209209
await expect(page.locator('.iris-grid-column')).toHaveScreenshot();
210210
});
211+
212+
test('html element has overscroll-behavior-x none to prevent browser back navigation', async ({
213+
page,
214+
}) => {
215+
// On macOS, horizontal overscroll at the viewport level triggers the browser's
216+
// back/forward navigation gesture. The app must set overscroll-behavior-x: none
217+
// on the <html> element to prevent this when users scroll to the edge of a grid.
218+
await openTable(page, 'simple_table');
219+
await waitForLoadingDone(page);
220+
221+
const htmlOverscrollX = await page.evaluate(() =>
222+
window.getComputedStyle(document.documentElement).getPropertyValue('overscroll-behavior-x')
223+
);
224+
expect(htmlOverscrollX).toBe('none');
225+
});

0 commit comments

Comments
 (0)