Conversation
…ouchscreen devices On Windows machines with a touchscreen (e.g. Surface), Chromium's device enumeration registers only the touch digitizer, so CSS media queries report (hover: none) / (pointer: coarse) even while a mouse is in use — and (any-hover: hover) / (any-pointer: fine) are false as well, so no CSS-side query can recover. Tailwind v4 compiles every hover/group-hover utility into @media (hover: hover), which left all hover styling in the app dead on such devices, including the reader tab close button. At startup, enumerate pointer devices via the Raw Input API; when a mouse or precision touchpad is present, append blink-settings overrides through WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS so the WebView reports a fine, hover-capable pointer. Touch capability is untouched (maxTouchPoints stays intact) and touch-only devices keep the current behavior.
The tab close button only appeared on hover, and hover-only UI is unusable when the webview reports no hover capability (see previous commit) — with several books open there was no way to close a specific tab. Show the close button permanently on the active tab, keep the hover-reveal behavior for inactive tabs, and label the button with a localized tooltip (tabs.close) in all supported languages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Windows 触屏设备(如 Surface)上,打开多本书后顶部标签页没有关闭按钮,无法关闭指定的标签页。
tab 关闭按钮原实现为
hidden group-hover:flex(悬停显示),但在这类设备上它永远不会出现。进一步排查发现影响不止于此——全应用的 hover 交互(按钮悬停变色、悬停显现的控件等)在这类设备上全部失效,tab 关闭按钮只是唯一造成功能损失的入口。根因
Tailwind v4 将所有
hover:/group-hover:工具类编译进@media (hover: hover)(已在构建产物 CSS 中确认)。Chromium/WebView2 在带触摸屏的 Windows 设备上,指针设备枚举只上报触屏数字化仪。实测本应用 WebView 的媒体查询矩阵:
(hover: hover)/(any-hover: hover)(pointer: fine)/(any-pointer: fine)(pointer: coarse)/maxTouchPoints连
any-hover/any-pointer: fine都是 false——鼠标在 WebView 的设备能力报告里完全不存在(即使正在使用鼠标),因此换用任何 CSS 写法(包括any-*查询)都无法恢复。鼠标事件本身(JS mousemove、:hover状态)是正常的,坏的只是能力上报这一层。修复
src-tauri,仅 Windows,无新增依赖,commit 1):启动时通过 Win32 Raw Input API 枚举指针设备,检测到鼠标或精确触摸板时,通过WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS追加--blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4,修正 WebView 的指针能力上报。maxTouchPoints仍为 10,不影响双指手势)。TabBar.tsx,commit 2):激活 tab 的关闭按钮常显(不再依赖 hover),非激活 tab 保留悬停显示;按钮补充多语言 tooltip(tabs.close,en/zh/zh-TW/ja/ko/fr/es 七种语言)。验证
hover:hover=false, any-hover:hover=false, pointer:fine=false, any-pointer:fine=false;修复后全部正确翻转。display仍为none;修复后正确翻转为flex(CSS 一行未改)。cargo check、tsc通过;改动的 lint 告警均为存量问题(HEAD 上即存在)。注:本次代码修复和PR信息的提交由AI生成