-
Notifications
You must be signed in to change notification settings - Fork 190
Fix(Mwpw-173688): Non-MPC videos honour o.s level accessibility setting. #4497
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
base: stage
Are you sure you want to change the base?
Conversation
|
libs/utils/decorate.js
Outdated
@@ -18,6 +18,7 @@ let videoLabels = { | |||
playIcon: 'Play icon', | |||
hasFetched: false, | |||
}; | |||
const isReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)') === true || window.matchMedia('(prefers-reduced-motion: reduce)').matches === true; |
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.
I'm not sure I understand the change in here 🤔
window.matchMedia() is always having an object as the return value, which makes window.matchMedia('(prefers-reduced-motion: reduce)') === true
redundant.
Please point it out if I'm missing something.
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.
Yes, My bad.
I thought that the matchmedia
function might return a boolean value in older versions but i was wrong.
I noticed that this(window.matchMedia('(prefers-reduced-motion: reduce)') === true
) always returns false and hence can be removed.
I have updated the code, feel free to review it again.
Thanks.
@@ -18,6 +18,7 @@ let videoLabels = { | |||
playIcon: 'Play icon', | |||
hasFetched: false, | |||
}; | |||
const isReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches; |
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.
Nit: Per me, this check could be reused across multiple blocks to guide their accessibility behaviour. Maybe it could be moved to libs/utils/utils.js
and imported here
This pull request is not passing all required checks. Please see this discussion for information on how to get all checks passing. Inconsistent checks can be manually retried. If a test absolutely can not pass for a good reason, please add a comment with an explanation to the PR. |
Resolves: MWPW-173688
Test URLs: