fix(tabs): stop touch input from arming tab drag reorder

This commit is contained in:
Melody Ruch authored and GitHub committed 2026-08-15 21:54:46 +08:00
1 parent 1d7fa00fe3
commit b6c83838f3
4 files changed
+53 -17

No files matched your search

@@ -544,10 +544,13 @@ function handleTabClick(tab: QueryTab) {
activateTab(tab.id);
}
function handleTabMouseDown(event: MouseEvent, tabId: string) {
function handleTabMouseDown(event: PointerEvent, tabId: string) {
if (event.button === 0) {
dispatchBeforeTabSwitch(tabId);
event.preventDefault();
// Don't preventDefault touch pointerdowns: that would cancel the tab
// strip's native horizontal scroll, which is how touch users browse an
// overflowing tab bar.
if (event.pointerType !== "touch") event.preventDefault();
}
tabDrag.startDrag(event, tabId);
}
@@ -663,7 +666,7 @@ function onOverflowItemKeydown(event: KeyboardEvent, tabId: string, kind: "regul
@click="handleTabClick(tab)"
@dblclick.stop="startRenameTab(tab)"
@mousedown.middle.prevent="queryStore.closeTab(tab.id)"
@mousedown="handleTabMouseDown($event, tab.id)"
@pointerdown="handleTabMouseDown($event, tab.id)"
@mouseenter="handleTabDragTarget($event, tab)"
@mousemove="handleTabDragTarget($event, tab)"
@mouseleave="tabDrag.clearTarget(tab.id)"
@@ -861,7 +864,7 @@ function onOverflowItemKeydown(event: KeyboardEvent, tabId: string, kind: "regul
@click="handleTabClick(tab)"
@dblclick.stop="startRenameTab(tab)"
@mousedown.middle.prevent="queryStore.closeTab(tab.id)"
@mousedown="handleTabMouseDown($event, tab.id)"
@pointerdown="handleTabMouseDown($event, tab.id)"
@mouseenter="handleTabDragTarget($event, tab)"
@mousemove="handleTabDragTarget($event, tab)"
@mouseleave="tabDrag.clearTarget(tab.id)"