Add slide up / down animation to User Feedback survey
See original GitHub issueFeature Description
The User Feedback survey is missing the slide up / down animation to show / hide the survey.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The user input survey box should not just appear, it should have an animation when it appears and disappears:
- When it appears, it should slide up into view from the bottom of the screen.
- When it disappears (e.g. completion or dismissal), it should slide down out of view back “into” the bottom of the screen.
- Potentially this can technically use https://material-ui.com/components/transitions/ - this is not a requirement though, just a note.
Implementation Brief
- Install the
@material-ui/core
package. - Using
assets/js/components/surveys/CurrentSurvey.js
,- Create a new state variable,
animateSurvey
which is aboolean
, withfalse
as default value. - Use the
useMount
hook to set theanimateSurvey
totrue
. - Create new function
handleAnimationOnExited
which calls thesetValues
action (which can be found in thedismissSurvey
function) to hide the form. Basically the form is hidden and unmounted when the animation is complete. - Wrap the markup for the survey questions (not when it has been completed) within the
Slide
component, imported from@material-ui/core
with the following props:direction="up"
in={ animateSurvey }
onExited={ handleAnimationOnExited }
- Update the
dismissSurvey
function to :- set
animateSurvey
tofalse
. - Remove the
setValues
call since we moved it to thehandleAnimationOnExited
function.
- set
- Create a new state variable,
Test Coverage
- No new tests to be added.
Visual Regression Changes
- N/A
QA Brief
- Run storybook locally via the
npm run storybook
command. - Visit the “Surveys -> Current Survey” story.
- The user feedback survey should slide up upon page load and slide down when closed.
Changelog entry
- Enhance user survey display with added animation on enter and exit.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Pure CSS Slide Up and Slide Down - David Walsh Blog
After playing around with different CSS properties, I've found a way to make a pure CSS sliding effect.
Read more >Executing UX Animations: Duration and Motion Characteristics
Animations in user experience can help by providing feedback and preventing disorientation or can be distracting, annoying, and dizzying.
Read more >Add animation to slides - Microsoft Support
Try it! Add animation and effects to text, pictures, shapes, and objects in your PowerPoint presentation. Add animations and effects.
Read more >Animate/transition content smoothly when it appears (after ...
$(".form-feedback .btn").click(async function () { let checkboxes ... I've added an animation to close the slideDown . You could also add a ...
Read more >Create advanced animations with smart animate
Open the Prototype tab in the right sidebar. · Select layer, group, or frame in the canvas. · Click on the node and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@eugene-manuilov That’s what I thought initially while working on this task. As per the docs:
So the direction is only for entering, and when exiting the animation, it’ll just do the reverse.
Thanks for catching that @tofumatt . Actually when I read your comment, am like it’s weird that we don’t have any callbacks when the animation starts or ends. I checked the docs and voila, we do have the
onExited
callback, which is called when the animation ends 😃 I’ve updated the IB to reflect that change. Also theSlide
component does have theunmountOnExit
prop which like the name says, unmounts the children when existing, which we could have used. But then the form data store will not be in sync with that’s visible/unmounted on the page. So I guess we can leave that to the data store to handle.