-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
Fade-out transition when closing the tooltip #1106
Conversation
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) | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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 --rt-transition-closing-delay
variable to setup a timeout for setRendered(false)
(as it was being done before, see code removed above), but it felt very hacky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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
--rt-transition-show-delay: 0.15s; | ||
--rt-transition-closing-delay: 0.15s; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
@danielbarion Is it a bad idea to introduce the fade-out animation on a minor release? We have the option to "disable" it by setting the CSS variable to a low value, and have it like this by default only on v6. It doesn't feel like a super huge change, but it's something to consider. |
This also broke the |
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) | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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
--rt-transition-show-delay: 0.15s; | ||
--rt-transition-closing-delay: 0.15s; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gabrieljablonski code looks good, just one typo on docs |
<p>This PR was automatically created by Snyk using the credentials of a real user.</p><br /><h3>Snyk has created this PR to upgrade react-tooltip from 5.21.6 to 5.22.0.</h3> :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project. <hr/> - The recommended version is **9 versions** ahead of your current version. - The recommended version was released **22 days ago**, on 2023-11-01. <details> <summary><b>Release notes</b></summary> <br/> <details> <summary>Package name: <b>react-tooltip</b></summary> <ul> <li> <b>5.22.0</b> - <a href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/releases/tag/v5.22.0">2023-11-01</a></br><p>If you like the project, please give the project a GitHub 🌟</p> <h2>What's Changed</h2> <ul> <li>Fade-out transition when closing the tooltip by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/gabrieljablonski/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/gabrieljablonski">@ gabrieljablonski</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1969455674" data-permission-text="Title is private" data-url="ReactTooltip/react-tooltip#1106" data-hovercard-type="pull_request" data-hovercard-url="/ReactTooltip/react-tooltip/pull/1106/hovercard" href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/pull/1106">#1106</a> <ul> <li>See <a href="https://react-tooltip.com/docs/examples/styling#customizing-openingclosing-animation" rel="nofollow">docs</a> for details</li> </ul> </li> <li>New props for selecting events to open/close the tooltip by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/gabrieljablonski/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/gabrieljablonski">@ gabrieljablonski</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1970604025" data-permission-text="Title is private" data-url="ReactTooltip/react-tooltip#1108" data-hovercard-type="pull_request" data-hovercard-url="/ReactTooltip/react-tooltip/pull/1108/hovercard" href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/pull/1108">#1108</a> <ul> <li>See <a href="https://react-tooltip.com/docs/options#:~:text=Use%20globalCloseEvents%20instead.-,openEvents,-Record%3Cstring%2C%20boolean" rel="nofollow">docs</a> for details</li> </ul> </li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/compare/v5.21.7...v5.22.0"><tt>v5.21.7...v5.22.0</tt></a></p> </li> <li> <b>5.22.0-beta.1109.1</b> - 2023-11-01 </li> <li> <b>5.22.0-beta.1109.0</b> - 2023-10-31 </li> <li> <b>5.22.0-beta.1108.0</b> - 2023-10-31 </li> <li> <b>5.22.0-beta.1106.0</b> - 2023-10-31 </li> <li> <b>5.22.0-beta.1091.1</b> - 2023-09-14 </li> <li> <b>5.22.0-beta.1091.0</b> - 2023-09-14 </li> <li> <b>5.21.7</b> - <a href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/releases/tag/v5.21.7">2023-11-01</a></br><p>If you like the project, please give the project a GitHub 🌟</p> <h2>What's Changed</h2> <ul> <li>Fix anchor on DOM change by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/gabrieljablonski/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/gabrieljablonski">@ gabrieljablonski</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1971537380" data-permission-text="Title is private" data-url="ReactTooltip/react-tooltip#1110" data-hovercard-type="pull_request" data-hovercard-url="/ReactTooltip/react-tooltip/pull/1110/hovercard" href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/pull/1110">#1110</a></li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/compare/v5.21.6...v5.21.7"><tt>v5.21.6...v5.21.7</tt></a></p> </li> <li> <b>5.21.7-beta.1110.0</b> - 2023-11-01 </li> <li> <b>5.21.6</b> - <a href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/releases/tag/v5.21.6">2023-10-24</a></br><p>If you like the project, please give the project a GitHub 🌟</p> <h2>What's Changed</h2> <ul> <li>Tiered sponsors by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/gabrieljablonski/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/gabrieljablonski">@ gabrieljablonski</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1924583073" data-permission-text="Title is private" data-url="ReactTooltip/react-tooltip#1099" data-hovercard-type="pull_request" data-hovercard-url="/ReactTooltip/react-tooltip/pull/1099/hovercard" href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/pull/1099">#1099</a></li> <li>README admonition by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/gabrieljablonski/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/gabrieljablonski">@ gabrieljablonski</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1936493747" data-permission-text="Title is private" data-url="ReactTooltip/react-tooltip#1101" data-hovercard-type="pull_request" data-hovercard-url="/ReactTooltip/react-tooltip/pull/1101/hovercard" href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/pull/1101">#1101</a></li> <li>Fix <code>anchorsBySelect</code> ref leak by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/gabrieljablonski/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://snyk.io/redirect/github/gabrieljablonski">@ gabrieljablonski</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1896963156" data-permission-text="Title is private" data-url="ReactTooltip/react-tooltip#1091" data-hovercard-type="pull_request" data-hovercard-url="/ReactTooltip/react-tooltip/pull/1091/hovercard" href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/pull/1091">#1091</a></li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/compare/v5.21.5...v5.21.6"><tt>v5.21.5...v5.21.6</tt></a></p> </li> </ul> from <a href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/releases">react-tooltip GitHub release notes</a> </details> </details> <details> <summary><b>Commit messages</b></summary> </br> <details> <summary>Package name: <b>react-tooltip</b></summary> <ul> <li><a href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/commit/dd53fa13326d8f09626512e50002dae1368dd3c8">dd53fa1</a> docs: open/close events</li> <li><a href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/commit/9e5d2f74baf25336acd75076a14b98181c90592a">9e5d2f7</a> docs: improve options table spacing</li> <li><a href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/commit/8e786af177d69d6d96021e990a32451ce44593da">8e786af</a> feat: open/close events</li> <li><a href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/commit/bd5fddfb12a91c6dd4fa1892760138b8530c4e9d">bd5fddf</a> docs: typo</li> <li><a href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/commit/a24ec2f8b3b8b393ba8a74c13d85c8520594bb65">a24ec2f</a> docs: tooltip closing transition</li> <li><a href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/commit/c645ce701bf3ede3b2090a81d3c20e635c87f0a7">c645ce7</a> feat: tooltip closing transition</li> <li><a href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/commit/9b03e2c0fef966bc727f34117fe1f8b1bb7935c1">9b03e2c</a> chore(version): v5.21.7</li> <li><a href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/commit/86a9fe4c5e3d329c1062a902f305ae14e3737603">86a9fe4</a> fix: anchor filter on dom change</li> <li><a href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/commit/d7f98e82f73b9eec92c80f01d4b73a176e5656a9">d7f98e8</a> docs: readme sponsorship banner width</li> </ul> <a href="https://snyk.io/redirect/github/ReactTooltip/react-tooltip/compare/3812314430666172a268d277e1f731584c58885d...dd53fa13326d8f09626512e50002dae1368dd3c8">Compare</a> </details> </details> <hr/> **Note:** *You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.* For more information: <img src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiJiNmE1NDNhZS05MDhjLTRiNTAtYjE4ZS02NTUxZDljYmY3MmIiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6ImI2YTU0M2FlLTkwOGMtNGI1MC1iMThlLTY1NTFkOWNiZjcyYiJ9fQ==" width="0" height="0"/> 🧐 [View latest project report](https://app.snyk.io/org/ecp88/project/98480bdc-d80b-4fd1-89d7-c4c56a706763?utm_source=github&utm_medium=referral&page=upgrade-pr) 🛠 [Adjust upgrade PR settings](https://app.snyk.io/org/ecp88/project/98480bdc-d80b-4fd1-89d7-c4c56a706763/settings/integration?utm_source=github&utm_medium=referral&page=upgrade-pr) 🔕 [Ignore this dependency or unsubscribe from future upgrade PRs](https://app.snyk.io/org/ecp88/project/98480bdc-d80b-4fd1-89d7-c4c56a706763/settings/integration?pkg=react-tooltip&utm_source=github&utm_medium=referral&page=upgrade-pr#auto-dep-upgrades) <!--- (snyk:metadata:{"prId":"b6a543ae-908c-4b50-b18e-6551d9cbf72b","prPublicId":"b6a543ae-908c-4b50-b18e-6551d9cbf72b","dependencies":[{"name":"react-tooltip","from":"5.21.6","to":"5.22.0"}],"packageManager":"npm","type":"auto","projectUrl":"https://app.snyk.io/org/ecp88/project/98480bdc-d80b-4fd1-89d7-c4c56a706763?utm_source=github&utm_medium=referral&page=upgrade-pr","projectPublicId":"98480bdc-d80b-4fd1-89d7-c4c56a706763","env":"prod","prType":"upgrade","vulns":[],"issuesToFix":[],"upgrade":[],"upgradeInfo":{"versionsDiff":9,"publishedDate":"2023-11-01T20:36:48.347Z"},"templateVariants":[],"hasFixes":false,"isMajorUpgrade":false,"isBreakingChange":false,"priorityScoreList":[]}) ---> Co-authored-by: snyk-bot <[email protected]>
Closes #1105.
Reminder to link to https://react-tooltip.com/docs/examples/styling#customizing-openingclosing-animation on release notes.
Beta version
[email protected]