Skip to content

Commit

Permalink
Disable animations in Pixel
Browse files Browse the repository at this point in the history
  • Loading branch information
jdlrobson committed Jan 11, 2024
1 parent 0484f68 commit 99282aa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/engine-scripts/puppet/disableAnimations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
async function disableAnimations( page ) {
page.on( 'load', () => {
const content = `*,
*::after,
*::before {
transition-delay: 0s !important;
transition-duration: 0s !important;
animation-delay: -0.0001s !important;
animation-duration: 0s !important;
animation-play-state: paused !important;
caret-color: transparent !important;
}`;

page.addStyleTag( { content } );
} );
}

module.exports = disableAnimations;
3 changes: 3 additions & 0 deletions src/engine-scripts/puppet/onReady.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const deferToFrame = require( './deferToFrame' );
const fastForwardAnimations = require( './fastForwardAnimations' );
const waitForIdle = require( './waitForIdle' );
const clickBtn = require( './clickBtn' );
const disableAnimations = require( './disableAnimations' );

/**
* Runs after onReady event on all scenarios -- use for simulating interactions.
Expand All @@ -17,6 +18,8 @@ module.exports = async ( page, scenario ) => {
// Make sure the main skin JavaScript module has loaded.
await require( './jsReady' )( page, hashtags );

await disableAnimations( page );

// These only apply to Vector 2022
if ( hashtags.includes( '#vector-2022' ) ) {
await require( './limitedWidth' )( page, hashtags );
Expand Down

0 comments on commit 99282aa

Please sign in to comment.