Repository navigation
fix(web-ui): prevent sticky hover tooltips on touch and coarse-pointer devices - #1275
Merged
Merged
Conversation
|
Caution Review failedThe pull request is closed. Summary
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
Summary
Fixes #1267
In mobile touch mode (
390×844), tapping top-bar controls such as the sidebar toggle (「打开侧边栏」) could leave a hover Tooltip stuck over the conversation title after entering a session.Root Cause
Tooltip.tsxsplit hover handling acrossonPointerEnter(gated onphone) andonMouseEnter(active whenever!phone), allowing synthesized touch compatibility mouse events and coarse-pointer/hover-none pointer events to open hover tooltips.pointerdownand lefttriggers.current.hoverset onclick.onFocusdid not check:focus-visibleand only guardeddata-dsh-automatic-focuswhenphonewas true.Changes
apps/web-ui/packages/client/ui-primitives/src/Tooltip.tsx:onPointerEnter/onPointerLeaveand ignore hover triggers whenpointerType === "touch"orwindow.matchMedia("(hover: none), (pointer: coarse)").matches.openOnClicktooltips ononPointerDownand clear bothhoverandfocustriggers inonClick.onFocustooltips on:focus-visibleand ignoredata-dsh-automatic-focusregardless of viewport.data-focuswhile preservingopenOnClick(data-pinned) and nestedTooltipSuppression.apps/web-ui/packages/client/ui-primitives/src/Tooltip.module.css:@media (hover: none), (pointer: coarse)guard hiding hover-only bubbles (.bubble:not([data-pinned]):not([data-focus])) without affectingopenOnClickor:focus-visibletooltips.No visual changes: suppresses stale hover-only tooltips on touch/coarse-pointer devices without altering desktop tooltip layout, styling, or keyboard
:focus-visiblebehavior.Validation
npx prettier --check apps/web-ui/packages/client/ui-primitives/src/Tooltip.tsx apps/web-ui/packages/client/ui-primitives/src/Tooltip.module.cssnpx eslint apps/web-ui/packages/client/ui-primitives/src/Tooltip.tsxnpx tsc -b packages/shared-contracts packages/desktop-control && npm run build:web:uinpx tsc --noEmit -p apps/web-ui/tsconfig.json