Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce hovercard false positives, add them to display names and handles #3739

Merged
merged 3 commits into from
Apr 28, 2024

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Apr 27, 2024

Instead of activating on pointer enter, activate on the first pointer move within.

This avoids triggering them just due to scroll. Intentionally moving the cursor still triggers it.

hover.mov

Copy link

render bot commented Apr 27, 2024

@gaearon gaearon force-pushed the hover-on-pointermove branch from 246ac48 to ef2eabd Compare April 27, 2024 23:59
Copy link

github-actions bot commented Apr 28, 2024

Old size New size Diff
6.44 MB 6.44 MB 107 B (0.00%)

@gaearon
Copy link
Collaborator Author

gaearon commented Apr 28, 2024

Now that this decreases the unintentional trigger rate, I'm adding them to display names and handles.

I've also bumped the threshold delay to 500ms to further reduce false positives.

more.mov

@gaearon gaearon changed the title Don't trigger hovercards on scroll Reduce hovercard false positives, add them to display names and handles Apr 28, 2024
@@ -244,12 +244,20 @@ export function ProfileHoverCardInner(props: ProfileHoverCardProps) {
}
}, [prefetchProfileQuery, props.did])

const onPointerEnterTarget = React.useCallback(() => {
const didFireHover = React.useRef(false)
const onPointerMoveTarget = React.useCallback(() => {
prefetchIfNeeded()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated, but this is another good use case for getting a bit more info from the API rather than just ProfileBasic. Added to a little list of "why we want this" for Wednesday.

Copy link
Contributor

@haileyok haileyok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels a lot better. The scroll issue was definitely noticeable when using a mouse w/ scroll wheel, but now I don't get those false positives. 🙏

@gaearon gaearon merged commit 3b4848b into main Apr 28, 2024
6 checks passed
@gaearon gaearon deleted the hover-on-pointermove branch April 28, 2024 12:59
estrattonbailey added a commit that referenced this pull request Apr 28, 2024
* origin:
  Fix dropdown immediately closing on Enter (#3745)
  Account for momentum when hiding minimal shell (#3740)
  Reduce hovercard false positives, add them to display names and handles (#3739)
  YouTube Music as supported player (#3736)
  Patch lexicon for perf (#3733)
  ensure dialog is closed on unmount (#3650)
  remove precacheThreadPostProfiles (#3729)
  [Clipclops] New routes with placeholder screens (#3725)
  Special-case bsky.app/download to open share sheet or copy to clipboard (#3710)
  ver bump (#3731)
  Improve usability of search on web (#3663)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants