Skip to content

Commit

Permalink
Delay only one direction of the animation
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed May 28, 2024
1 parent 91c79d3 commit e6f8f78
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
11 changes: 7 additions & 4 deletions packages/edit-site/src/components/layout/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,20 @@
height: 100%;
}

/* stylelint-disable */
::view-transition-group(toggle) {
animation-delay: 250ms;
/* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
html:active-view-transition-type(canvas-mode-edit) {
&::view-transition-group(toggle) {
animation-delay: 250ms;
}
}
.edit-site-layout:not(.is-full-canvas) .edit-site-layout__sidebar-region .edit-site-layout__view-mode-toggle {
view-transition-name: toggle;
}
.edit-site-layout.is-full-canvas .edit-site-layout__canvas .edit-site-layout__view-mode-toggle {
view-transition-name: toggle;
}
/* stylelint-enable */
/* stylelint-enable */

.edit-site-layout.is-full-canvas .edit-site-layout__sidebar-region .edit-site-layout__view-mode-toggle {
display: none;
}
Expand Down
7 changes: 5 additions & 2 deletions packages/edit-site/src/store/private-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ export const setCanvasMode =
if ( ! document.startViewTransition ) {
switchCanvasMode();
} else {
document.startViewTransition( () => {
switchCanvasMode();
document.startViewTransition( {
update: () => {
switchCanvasMode();
},
types: [ 'canvas-mode-' + mode ],
} );
}
};
Expand Down

0 comments on commit e6f8f78

Please sign in to comment.