Skip to content

fix: improve clipboard success animation in code blocks (#7946) #7950

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Everkers
Copy link

@Everkers Everkers commented Jul 4, 2025

Description

Improves the clipboard success animation for code blocks.
The previous animation was abrupt and barely visible, which felt out of place compared to the otherwise modern UI. This PR introduces a smoother transition, to improve visibility and user experience.

Validation

Tested locally by clicking the copy button on multiple code blocks.
The new animation is clearly visible, smoother, and feels more consistent with the design language of the site.

Related Issues

Fixes #7946

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run pnpm format to ensure the code follows the style guide.
  • I have run pnpm test to check if all tests are passing.
  • I have run pnpm build to check if the website builds without errors.
  • [] I've covered new added functionality with unit tests if necessary.
Screen.Recording.2025-07-04.at.3.09.44.PM.mov

@Everkers Everkers requested a review from a team as a code owner July 4, 2025 14:11
Copy link

vercel bot commented Jul 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Jul 4, 2025 2:13pm

Copy link
Member

@avivkeller avivkeller Jul 4, 2025

Choose a reason for hiding this comment

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

Does setting the swipeDirection not do all of this for you?

Copy link
Author

Choose a reason for hiding this comment

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

swapDirection only indicates the direction of the animation. It only takes effect once the appropriate animation classes are added in the CSS module.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure about animation is required or not. But this implementation follows radix docs.
LGTM!

Comment on lines 15 to +35

.root[data-state='open'] {
animation: slide-in 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.root[data-state='closed'] {
animation: slide-out 200ms ease-in forwards;
}

.root[data-swipe='move'] {
transform: translateX(var(--radix-toast-swipe-move-x));
}

.root[data-swipe='cancel'] {
transform: translateX(0);
transition: transform 200ms ease-out;
}

.root[data-swipe='end'] {
animation: swipe-out 150ms ease-out forwards;
}
Copy link
Member

Choose a reason for hiding this comment

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

A) I'm not sure how I feel about the added complexity of a swipe
B) use tailwinds @apply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The clipboard success message is abrupt and vanishes too fast
4 participants