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

Smooth out the block switcher animation #9468

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions packages/editor/src/components/block-switcher/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
padding: 0 6px;
display: flex;
align-items: center;
transition: all 0.1s cubic-bezier(0.165, 0.84, 0.44, 1);

// The opacity and transform transitions use separate easings so the opacity
// animation starts while the "incoming" icon is mostly in frame.
transition: opacity 0.2s cubic-bezier(1, 0, 0.8, 0.65), transform 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
}

// Add a dropdown arrow indicator.
Expand All @@ -54,16 +57,28 @@
border-radius: $radius-round-rectangle;
height: $icon-button-size-small + 6px;
padding: 3px 9px 3px 9px;

// Start fully transparent so the icon fades into place.
opacity: 0;
}

// Block hover and focus style.
&[aria-expanded="true"] .editor-block-icon,
&[aria-expanded="true"] .editor-block-switcher__transform,
&:not(:disabled):hover .editor-block-icon,
&:not(:disabled):hover .editor-block-switcher__transform,
&:not(:disabled):focus .editor-block-icon,
&:not(:disabled):focus .editor-block-switcher__transform {
transform: translateY(-$icon-button-size);
&[aria-expanded="true"],
&:not(:disabled):hover,
&:not(:disabled):focus {
.editor-block-icon,
.editor-block-switcher__transform {
transform: translateY(-$icon-button-size);
}

// Swap the icon opacities on hover.
.editor-block-icon {
opacity: 0;
}

.editor-block-switcher__transform {
opacity: 1;
}
}

// Block focus style.
Expand Down