From 9ca026d6afc22f358b60592faf88d94850a66969 Mon Sep 17 00:00:00 2001 From: Tim Mok Date: Thu, 21 Nov 2024 11:04:52 -0500 Subject: [PATCH 1/2] Fix console scrolling for web Listen to console container scroll and forward event to parent container --- .../browser/components/consoleInstance.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/positronConsole/browser/components/consoleInstance.tsx b/src/vs/workbench/contrib/positronConsole/browser/components/consoleInstance.tsx index e4f317b908f..7b383eae982 100644 --- a/src/vs/workbench/contrib/positronConsole/browser/components/consoleInstance.tsx +++ b/src/vs/workbench/contrib/positronConsole/browser/components/consoleInstance.tsx @@ -566,6 +566,15 @@ export const ConsoleInstance = (props: ConsoleInstanceProps) => { } }; + /** + * Fixes the scroll event override that VS Code drops to prevent gesture navigation. + * @param e A WheelEvent + */ + const scrollOverrideHandler = (e: WheelEvent) => { + consoleInstanceRef.current.scrollBy(e.deltaX, e.deltaY); + e.preventDefault(); + }; + /** * onWheel event handler. * @param e A WheelEvent that describes a user interaction with the wheel. @@ -608,7 +617,11 @@ export const ConsoleInstance = (props: ConsoleInstanceProps) => { onMouseDown={mouseDownHandler} onWheel={wheelHandler} onScroll={scrollHandler}> -
+
Date: Thu, 21 Nov 2024 11:09:06 -0500 Subject: [PATCH 2/2] Add isWeb check --- .../positronConsole/browser/components/consoleInstance.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/positronConsole/browser/components/consoleInstance.tsx b/src/vs/workbench/contrib/positronConsole/browser/components/consoleInstance.tsx index 7b383eae982..e37b2c5dffc 100644 --- a/src/vs/workbench/contrib/positronConsole/browser/components/consoleInstance.tsx +++ b/src/vs/workbench/contrib/positronConsole/browser/components/consoleInstance.tsx @@ -14,7 +14,7 @@ import { KeyboardEvent, MouseEvent, UIEvent, useCallback, useEffect, useLayoutEf import * as nls from 'vs/nls'; import * as DOM from 'vs/base/browser/dom'; import { generateUuid } from 'vs/base/common/uuid'; -import { isMacintosh } from 'vs/base/common/platform'; +import { isMacintosh, isWeb } from 'vs/base/common/platform'; import { PixelRatio } from 'vs/base/browser/pixelRatio'; import { disposableTimeout } from 'vs/base/common/async'; import { DisposableStore } from 'vs/base/common/lifecycle'; @@ -571,8 +571,9 @@ export const ConsoleInstance = (props: ConsoleInstanceProps) => { * @param e A WheelEvent */ const scrollOverrideHandler = (e: WheelEvent) => { - consoleInstanceRef.current.scrollBy(e.deltaX, e.deltaY); - e.preventDefault(); + if (isWeb) { + consoleInstanceRef.current.scrollBy(e.deltaX, e.deltaY); + } }; /**