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

chore: adding appear animations to modal dialog and overlay #30258

Merged
merged 3 commits into from
Feb 13, 2025

Conversation

georgewrmarshall
Copy link
Contributor

@georgewrmarshall georgewrmarshall commented Feb 11, 2025

Description

This PR adds entrance animations to our modal components while ensuring accessibility through proper motion reduction support. The changes include:

  1. Modal Content Animation:

    • Added a smooth slide-up animation with fade-in effect (400ms duration)
    • Uses a custom cubic-bezier timing function for natural movement
    • Initial 24px offset for subtle entrance
  2. Modal Overlay Animation:

    • Added fade-in animation (250ms duration)
    • Uses linear timing for consistent transparency transition
  3. Accessibility Considerations:

    • All animations respect the user's motion preferences using prefers-reduced-motion
    • When reduced motion is preferred, content appears instantly without animation
    • Maintains full functionality while improving the experience for users who enjoy motion

These enhancements make our modals feel more polished while maintaining accessibility standards.

Open in GitHub Codespaces

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/4047

Manual testing steps

Testing Modal Motion

  1. Open the storybook build to this PR
  2. Search for Modal
  3. Verify the modal overlay fades in smoothly
  4. Verify the modal content slides up with a subtle animation
  5. Test on different screen sizes to ensure animations remain smooth

Testing Prefers Reduced Motion

  1. Open Dev Tools
  2. Go to the kebab menu in the top right
  3. Select More Tools > Redering
  4. Scroll down to enable prefers reduced-motion
  5. Verify animation of the modal is removed

Screenshots/Recordings

Before

Modal appears instantly without animation

before720.mov

After

Modal fades and slides in smoothly but removes animation when prefers-reduced-motion is enabled

modal.after720.mov

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@georgewrmarshall georgewrmarshall added the team-design-system All issues relating to design system in Extension label Feb 11, 2025
@georgewrmarshall georgewrmarshall self-assigned this Feb 11, 2025
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@@ -34,6 +34,8 @@

max-height: 100%;
box-shadow: var(--shadow-size-lg) var(--color-shadow-default);
animation: mm-modal-slide-up 400ms cubic-bezier(0.3, 0.8, 0.3, 1) forwards;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add prefers reduced motion media query to remove the animation

Copy link
Contributor

Choose a reason for hiding this comment

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

Love the addition of the media query for reduced motion

@metamaskbot
Copy link
Collaborator

Builds ready [fff51b1]
Page Load Metrics (1642 ± 97 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint14092059164720498
domContentLoaded14012051162620397
load14092059164220297
domInteractive2287412311
backgroundConnect96523178
firstReactRender1476472311
getState4499105
initialActions00000
loadScripts9031552116317684
setupStore511821
uiStartup159122941828214103
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@georgewrmarshall georgewrmarshall marked this pull request as ready for review February 12, 2025 23:33
@georgewrmarshall georgewrmarshall requested a review from a team as a code owner February 12, 2025 23:33
@georgewrmarshall georgewrmarshall added this pull request to the merge queue Feb 13, 2025
Merged via the queue into main with commit d338a5e Feb 13, 2025
76 checks passed
@georgewrmarshall georgewrmarshall deleted the fix/modal-motion branch February 13, 2025 18:36
@github-actions github-actions bot locked and limited conversation to collaborators Feb 13, 2025
@metamaskbot metamaskbot added the release-12.13.0 Issue or pull request that will be included in release 12.13.0 label Feb 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.13.0 Issue or pull request that will be included in release 12.13.0 team-design-system All issues relating to design system in Extension
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants