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

[Tooltip]: Validates arrow positioning / adds timeout props #464

Conversation

benjaminknox
Copy link
Contributor

@benjaminknox benjaminknox commented Oct 31, 2023

Right now in main, if you hover over a tooltip and hover out a few times, the arrow positioning sometimes computes incorrectly. This fixes it by validating arrow positioning before firing the computedposition event on the Floating element.

This PR also adds a few other things discussed with @fallaciousreasoning, a prop named mouseleaveTimeout for the debounce timeout on the mouse leave event, and defaults to no fadeout animation on the tooltip, with a prop named fadeDuration to set it if desired.

Screenshots

Arrow Position Bug Before

Screen.Recording.2023-10-31.at.3.38.30.PM.mov

Arrow Position Bug After

Screen.Recording.2023-10-31.at.3.39.18.PM.mov
Screen.Recording.2023-10-31.at.4.35.19.PM.mov

@benjaminknox benjaminknox force-pushed the bpk/fix-tooltip-arrow-position-bug branch from d6fc52e to 65732be Compare October 31, 2023 20:51
Copy link
Collaborator

@fallaciousreasoning fallaciousreasoning left a comment

Choose a reason for hiding this comment

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

LGTM, with one question 😄

src/components/floating/floating.svelte Show resolved Hide resolved
/* Whether the tooltip is currently visible */
export let visible: boolean | undefined = undefined

/** The length of time in ms the tooltip element takes to fade
* after the users mouse leaves the trigger or tooltip*/
export let fadeDuration: number = 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice!

@fallaciousreasoning fallaciousreasoning merged commit 0e8f7e2 into brave:main Nov 2, 2023
5 checks passed
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