-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
feat: add PANTHER_REDUCED_MOTION to limit animations #651
Conversation
0d04f2a
to
83527aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! We should even enable this by default.
src/ProcessManager/ChromeManager.php
Outdated
@@ -114,6 +114,11 @@ private function getDefaultArguments(): array | |||
$args[] = '--no-sandbox'; | |||
} | |||
|
|||
// Prefer reduced motion, see https://developer.mozilla.org/fr/docs/Web/CSS/@media/prefers-reduced-motion | |||
if ($_SERVER['PANTHER_REDUCED_MOTION'] ?? false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ($_SERVER['PANTHER_REDUCED_MOTION'] ?? false) { | |
if (filter_var($_SERVER['PANTHER_REDUCED_MOTION'] ?? true, \FILTER_VALIDATE_BOOLEAN)) { |
(see #632)
@@ -63,6 +64,14 @@ public function start(): WebDriver | |||
$capabilities = DesiredCapabilities::firefox(); | |||
$capabilities->setCapability('moz:firefoxOptions', $firefoxOptions); | |||
|
|||
// Prefer reduced motion, see https://developer.mozilla.org/fr/docs/Web/CSS/@media/prefers-reduced-motion | |||
if ($_SERVER['PANTHER_REDUCED_MOTION'] ?? false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ($_SERVER['PANTHER_REDUCED_MOTION'] ?? false) { | |
if (filter_var($_SERVER['PANTHER_REDUCED_MOTION'] ?? true, \FILTER_VALIDATE_BOOLEAN)) { |
83527aa
to
99ab383
Compare
I totally agree 🙂 |
Maybe make this config the default and introduce a |
It makes sense with I also added a test (and fixed a bug spotted by it). |
c9fe896
to
feb27a8
Compare
Thank you! |
@dunglas FYI, I'm trying to understand why https://github.com/symfony/panther/actions/runs/12673280007/job/35319306027?pr=651 is failing |
Thanks! |
This PR add a
PANTHER_REDUCED_MOTION
environment variable to set theprefers-reduced-motion
CSS media feature toreduce
.It could be useful to limit "flaky" tests which result in a
Facebook\WebDriver\Exception\ElementClickInterceptedException: Element <XXX> is not clickable at point (XXX, YYY) because another element XXX obscures it
exception because an animation is still in progress.This CSS media feature is already supported by Bootstrap or the french DSFR.