-
Notifications
You must be signed in to change notification settings - Fork 174
chore: Refine exit motion for global drawer #3529
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3529 +/- ##
==========================================
+ Coverage 96.54% 96.56% +0.01%
==========================================
Files 805 805
Lines 23446 23449 +3
Branches 7750 8106 +356
==========================================
+ Hits 22637 22644 +7
+ Misses 802 752 -50
- Partials 7 53 +46 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Replaced the 3rd party Transition component with the internal one. This change provides an expected motion behavior that we wanted to achieve with minimum change on the global drawer style. One note is that the |
@@ -75,8 +75,9 @@ function AppLayoutGlobalDrawerImplementation({ | |||
(wasExpanded && !isExpanded); | |||
|
|||
return ( | |||
<Transition nodeRef={drawerRef} in={show || isExpanded} appear={show || isExpanded} timeout={0}> | |||
{state => { | |||
<Transition in={show} exit={!show}> |
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.
Note: Removed isExpanded
condition because when 'isExpanded' it's always show
.
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.
Note: The appear
props is not available in the internal Transition component. If necessary we can introduce it, but before that I want to discuss if it's necessary.
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.
This PR introduces a closing animation only for global drawers with preserveInactiveContent: true
, and only after they’ve been opened at least once. The first open is not animated. However, it also breaks the existing animation for global drawers that don’t use preserveInactiveContent: true
. See the video below for reference.
Screen.Recording.2025-05-26.at.15.09.44.mov
@georgylobko I've addressed those issues as follows:
Note:
|
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.
Fixed by removing the defaultActive condition from animationDisabled
this code was introduced on purpose and should be there, it makes sure that animation is not applied on initial load in consoles. you cannot just remove existing conditions
Fixed by using hasOpened state to control Transition's in prop
why? you already have a prop show
. what is the purpose of this addition?
@georgylobko Thanks for your feedback!
Got it, I've brought it back.
When a drawer mounts with
Without
The state is necessary to force the proper animation sequence on first mount, while still respecting the |
if (!hasTriggerButton) { | ||
return; | ||
} | ||
<Transition in={hasOpened && show} exit={!show}> |
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.
Curious why this file got completely reformatted? Could you check your linter and turn it back?
setTransitionState('enter'); | ||
onStatusChange('enter'); | ||
} | ||
appear={true} |
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.
This component is used in multiple other places. Did you make sure other components / use cases aren't affected?
Description
This PR fixes an animation issue for global-drawer.
We would like to have a smooth transition when a drawer is being closed.
Before this change, the style
drawer-hidden
was added immediately when a close button is clicked, which was one of the two reasons for the unwanted sudden closing behavior. To address this, an additional condition has been added to make sure only after the Transition's component state becomes exited.:[styles['drawer-hidden']]: !show && state === 'exited'
And I updated relevant styles accordingly.
Additionally, I've added Transition component to the
global-tools
in the skeleton to ensure only after it gets thepanel-hidden
style.Issue-2.mp4
Related links, issue #, if available: n/a
How has this been tested?
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md
.CONTRIBUTING.md
.Security
checkSafeUrl
function.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.