revert: restore auto-hiding overlay scrollbars

This commit is contained in:
Bohdan Triapitsyn
2026-08-09 19:53:49 +03:00
parent f4743ea060
commit 121685e564
2 changed files with 4 additions and 22 deletions
@@ -25,12 +25,6 @@ const isSameThumbMetrics = (a: ThumbMetrics, b: ThumbMetrics): boolean => {
return Math.abs(a.length - b.length) < METRIC_EPSILON && Math.abs(a.offset - b.offset) < METRIC_EPSILON;
};
// Desktop shells (Electron, VS Code webview) use persistent, not
// auto-hiding, scrollbars. Reads the same `desktop-runtime` root class that
// index.css keys off, so JS and CSS never disagree on what counts as desktop.
const isDesktopScrollbarRuntime = (): boolean =>
typeof document !== "undefined" && document.documentElement.classList.contains("desktop-runtime");
const OverlayScrollbarComponent: React.FC<OverlayScrollbarProps> = ({
containerRef,
minThumbSize = 32,
@@ -134,15 +128,8 @@ const OverlayScrollbarComponent: React.FC<OverlayScrollbarProps> = ({
if (isHoveringRef.current) {
return;
}
// Desktop shells keep the thumb visible once shown instead of
// auto-hiding it after a delay. userIntentOnly callers (e.g. chat
// auto-follow scroll) opt out of persistence on purpose, so they keep
// the existing auto-hide behavior even on desktop.
if (isDesktopScrollbarRuntime() && !userIntentOnly) {
return;
}
hideTimeoutRef.current = setTimeout(() => setVisible(false), hideDelayMs);
}, [hideDelayMs, userIntentOnly]);
}, [hideDelayMs]);
const markUserIntent = React.useCallback(() => {
lastUserIntentAtRef.current = Date.now();
@@ -175,10 +162,7 @@ const OverlayScrollbarComponent: React.FC<OverlayScrollbarProps> = ({
if (!container) return;
updateMetrics();
// On desktop shells, show the thumb immediately if content overflows
// instead of waiting for the first scroll event (persistent affordance,
// matching native desktop scrollbar conventions).
setVisible(isDesktopScrollbarRuntime() && !userIntentOnly);
setVisible(false);
const onScroll = () => handleScroll();
const onKeyDown = (event: KeyboardEvent) => {
+2 -4
View File
@@ -1804,10 +1804,8 @@ input[aria-label="Terminal input"] {
}
/* Settings dialog: hide the overlay scrollbar on mobile/web; wheel/keyboard
scroll still works. Desktop shells keep the persistent scrollbar so the
Settings sub-panels aren't left with no scroll affordance at all. */
html:not(.desktop-runtime) [data-settings-view="true"] .overlay-scrollbar {
/* Settings dialog: hide the overlay scrollbar; wheel/keyboard scroll still works. */
[data-settings-view="true"] .overlay-scrollbar {
display: none;
}