fix(architecture): gate glossary hover-preview to hover-capable machines#39
Merged
Conversation
The .kw tooltip fired mouseenter/mouseleave on every device, so touch
devices got a synthetic hover flash right before the tap-to-pin. Gate
the hover-preview behind matchMedia('(hover: hover) and (pointer: fine)').
Tap-to-pin and keyboard focus/blur stay wired on all devices.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts the Architecture diagram glossary tooltip wiring to prevent synthetic hover “flashes” on touch devices by only attaching hover-preview handlers when the environment reports a hover-capable, fine pointer.
Changes:
- Introduces a
canHovermedia-query gate for hover preview (mouseenter/mouseleave) on.kwglossary buttons. - Keeps click/tap-to-pin and keyboard focus/blur behavior enabled for all devices.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // with a fine pointer (mouse/trackpad). Touch devices report (hover: none) | ||
| // and would otherwise fire a synthetic mouseenter flash right before the | ||
| // tap-to-pin — there, tap and keyboard focus remain the way in. | ||
| const canHover = window.matchMedia('(hover: hover) and (pointer: fine)').matches; |
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
The architecture-diagram glossary terms (
.kwbuttons) wired their hover-preview (mouseenter/mouseleave) on every device. On touch devices that fires a synthetic hover flash of the popover right before the tap-to-pin.This gates the hover-preview behind
matchMedia('(hover: hover) and (pointer: fine)'), so only mouse/trackpad machines get hover. Tap-to-pin and keyboard focus/blur stay wired on all devices, so touch and keyboard/AT users are unaffected.Salvaged from the closed #38 (the rest of that branch was already superseded by #32–#37); this is the one net-new delta, rebased cleanly onto current
main.Verification
npm run buildandnpm run checkpass.hover:hover,pointer:fine) → hover shows the tooltip, tap pins it, keyboard focus shows it.hover:none,pointer:coarse) → hover suppressed (no flash), tap opens the pinned popover, keyboard focus still works.🤖 Generated with Claude Code