From 7b1c6807bacb1740c2f4543358068381844ec8ab Mon Sep 17 00:00:00 2001 From: SiriusXT <1160925501@qq.com> Date: Thu, 5 Jun 2025 20:20:29 +0800 Subject: [PATCH] fix(tab-row): Remove shift+wheel tab switching --- apps/client/src/widgets/tab_row.ts | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/apps/client/src/widgets/tab_row.ts b/apps/client/src/widgets/tab_row.ts index 79a9eb960..bfd3fe918 100644 --- a/apps/client/src/widgets/tab_row.ts +++ b/apps/client/src/widgets/tab_row.ts @@ -400,7 +400,7 @@ export default class TabRowWidget extends BasicWidget { } }; this.$tabScrollingContainer[0].addEventListener('wheel', async (event) => { - if (utils.isCtrlKey(event) || event.altKey) { + if (utils.isCtrlKey(event) || event.altKey || event.shiftKey) { return; } event.preventDefault(); @@ -409,25 +409,16 @@ export default class TabRowWidget extends BasicWidget { // Set an upper limit to avoid scrolling too fast // no lower limit is set because touchpad deltas are usually small const delta = Math.sign(event.deltaX + event.deltaY) * Math.min(Math.abs(event.deltaX + event.deltaY), TAB_CONTAINER_MIN_WIDTH * 3); - - if (!event.shiftKey) { - // Check if the device has reduced motion enabled - if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) { - this.scrollTabContainer(delta, "instant"); - } else { - pendingScroll += delta - if (!isScrolling) { - isScrolling = true; - stepScroll(); - } + + // Check if the device has reduced motion enabled + if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) { + this.scrollTabContainer(delta, "instant"); + } else { + pendingScroll += delta + if (!isScrolling) { + isScrolling = true; + stepScroll(); } - } else if (event.shiftKey) { - if (delta > 0) { - await appContext.tabManager.activateNextTabCommand(); - } else { - await appContext.tabManager.activatePreviousTabCommand(); - } - this.activeTabEl.scrollIntoView(); } });