fix: 标签栏滚轮滚动和自动定位问题

- 修复滚轮不生效:使用 capture 阶段监听 wheel 事件
- 修复滚轮不生效:添加 stopPropagation 防止事件被拦截
- 新增自动滚动到活动标签:切换/打开标签时自动定位到可见区域
- 优化 CSS:移除 #tab-bar 的 overflow,由 #tab-list 统一负责滚动
- 添加平滑滚动:scroll-behavior: smooth
This commit is contained in:
thzxx
2026-05-28 14:30:09 +08:00
parent e0961ca8f0
commit 80dc7406e3
2 changed files with 33 additions and 24 deletions
+12 -21
View File
@@ -470,26 +470,7 @@ html, body {
align-items: flex-end;
padding: 0 4px;
flex-shrink: 0;
overflow-x: auto;
overflow-y: hidden;
}
/* 标签栏滚动条:默认隐藏,hover 时显示 */
#tab-bar::-webkit-scrollbar {
height: 3px;
}
#tab-bar::-webkit-scrollbar-thumb {
background: var(--border);
border-radius: 2px;
}
#tab-bar::-webkit-scrollbar-thumb:hover {
background: var(--text-tertiary);
}
#tab-bar::-webkit-scrollbar-track {
background: transparent;
/* 不设置 overflow,由 #tab-list 负责滚动 */
}
#tab-list {
@@ -500,9 +481,11 @@ html, body {
min-width: 0;
overflow-x: auto;
overflow-y: hidden;
/* 平滑滚动 */
scroll-behavior: smooth;
}
/* 标签列表滚动条:默认隐藏,hover 时显示 */
/* 标签列表滚动条 */
#tab-list::-webkit-scrollbar {
height: 3px;
}
@@ -520,6 +503,14 @@ html, body {
background: transparent;
}
#tab-list::-webkit-scrollbar-thumb:hover {
background: var(--text-tertiary);
}
#tab-list::-webkit-scrollbar-track {
background: transparent;
}
.tab-item {
display: flex;
align-items: center;