-
-
Notifications
You must be signed in to change notification settings - Fork 535
Fade-out transition when closing the tooltip #1106
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,24 +82,6 @@ const Tooltip = ({ | |
| } | ||
| }, []) | ||
|
|
||
| useEffect(() => { | ||
| if (!show) { | ||
| /** | ||
| * this fixes weird behavior when switching between two anchor elements very quickly | ||
| * remove the timeout and switch quickly between two adjancent anchor elements to see it | ||
| * | ||
| * in practice, this means the tooltip is not immediately removed from the DOM on hide | ||
| */ | ||
| const timeout = setTimeout(() => { | ||
| setRendered(false) | ||
| }, 150) | ||
| return () => { | ||
| clearTimeout(timeout) | ||
| } | ||
| } | ||
| return () => null | ||
| }, [show]) | ||
|
|
||
| const handleShow = (value: boolean) => { | ||
| if (!mounted.current) { | ||
| return | ||
|
|
@@ -657,13 +639,21 @@ const Tooltip = ({ | |
| styles[variant], | ||
| className, | ||
| `react-tooltip__place-${actualPlacement}`, | ||
| { | ||
| 'react-tooltip__show': canShow, | ||
| [coreStyles['show']]: canShow, | ||
| [coreStyles['fixed']]: positionStrategy === 'fixed', | ||
| [coreStyles['clickable']]: clickable, | ||
| }, | ||
| coreStyles[canShow ? 'show' : 'closing'], | ||
| canShow ? 'react-tooltip__show' : 'react-tooltip__closing', | ||
| positionStrategy === 'fixed' && coreStyles['fixed'], | ||
| clickable && coreStyles['clickable'], | ||
| )} | ||
| onTransitionEnd={(event: TransitionEvent) => { | ||
| /** | ||
| * @warning if `--rt-transition-closing-delay` is set to 0, | ||
| * the tooltip will be stuck (but not visible) on the DOM | ||
| */ | ||
| if (show || event.propertyName !== 'opacity') { | ||
| return | ||
| } | ||
| setRendered(false) | ||
| }} | ||
|
Comment on lines
+647
to
+656
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there an obvious alternative to this? Thought about doing a check on the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do agree, we can find a better solution for this on V6 |
||
| style={{ | ||
| ...externalStyles, | ||
| ...inlineStyles, | ||
|
|
@@ -678,13 +668,7 @@ const Tooltip = ({ | |
| coreStyles['arrow'], | ||
| styles['arrow'], | ||
| classNameArrow, | ||
| { | ||
| /** | ||
| * changed from dash `no-arrow` to camelcase because of: | ||
| * https://github.com/indooorsman/esbuild-css-modules-plugin/issues/42 | ||
| */ | ||
| [coreStyles['noArrow']]: noArrow, | ||
| }, | ||
| noArrow && coreStyles['noArrow'], | ||
| )} | ||
| style={{ | ||
| ...inlineArrowStyles, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,4 +6,6 @@ | |
| --rt-color-warning: #f0ad4e; | ||
| --rt-color-info: #337ab7; | ||
| --rt-opacity: 0.9; | ||
| --rt-transition-show-delay: 0.15s; | ||
| --rt-transition-closing-delay: 0.15s; | ||
|
Comment on lines
+9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After testing for some time, 0.3s started feeling waaaay too long. Still open for suggestions though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.