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

Try adding a subtle animation to innerblock selection when padding is added. #16817

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions assets/stylesheets/_animations.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,15 @@
animation-fill-mode: forwards;
@include reduce-motion("animation");
}

@mixin edit-post__inner-blocks-padding-animation($speed: 0.1s, $delay: 0s) {
animation: edit-post__inner-blocks-padding-animation $speed ease-out $delay;
animation-fill-mode: forwards;
@include reduce-motion("animation");
}

@mixin edit-post__inner-blocks-padding-negative-animation($speed: 0.1s, $delay: 0s) {
animation: edit-post__inner-blocks-padding-negative-animation $speed ease-out $delay;
animation-fill-mode: forwards;
@include reduce-motion("animation");
}
7 changes: 7 additions & 0 deletions packages/block-library/src/columns/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,17 @@ div.block-core-columns.is-vertically-aligned-bottom {
.block-editor-block-list__layout .block-editor-block-list__block[data-type="core/column"].is-selected > .block-editor-block-list__block-edit > [data-block] > div > .block-editor-inner-blocks,
.block-editor-block-list__layout .block-editor-block-list__block[data-type="core/column"].has-child-selected > .block-editor-block-list__block-edit > [data-block] > div > .block-editor-inner-blocks {
padding: $block-padding;
@include edit-post__inner-blocks-padding-animation();

// Negate this padding for the placeholder.
> .components-placeholder {
margin: -$block-padding;
width: calc(100% + #{$block-padding * 2});
}

// Negate the animation for the appender and placeholders.
> .block-editor-block-list__layout > .block-list-appender,
> .components-placeholder {
@include edit-post__inner-blocks-padding-negative-animation();
}
}
6 changes: 6 additions & 0 deletions packages/block-library/src/group/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@

> .wp-block-group__inner-container > .block-editor-inner-blocks {
padding: $block-padding;
@include edit-post__inner-blocks-padding-animation();

// Negate the animation for the appender.
> .block-editor-block-list__layout > .block-list-appender {
@include edit-post__inner-blocks-padding-negative-animation();
}
}

&:not(.has-background) > .wp-block-group__inner-container > .block-editor-inner-blocks > .block-editor-block-list__layout {
Expand Down
19 changes: 19 additions & 0 deletions packages/edit-post/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,25 @@
}
}

@keyframes edit-post__inner-blocks-padding-animation {
from {
transform: scale(1.01);
}
to {
transform: scale(1);
}
}

// This negates the animation above, and is used on child elements that don't require animation.
@keyframes edit-post__inner-blocks-padding-negative-animation {
from {
transform: scale(0.99);
}
to {
transform: scale(1);
}
}

// In order to use mix-blend-mode, this element needs to have an explicitly set background-color
// We scope it to .wp-toolbar to be wp-admin only, to prevent bleed into other implementations
html.wp-toolbar {
Expand Down