-
Notifications
You must be signed in to change notification settings - Fork 384
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
Check mute toggle when autoplay is enable and show notice when attempting to autoplay unmuted video #6547
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #6547 +/- ##
=============================================
+ Coverage 75.48% 75.60% +0.12%
+ Complexity 6024 6023 -1
=============================================
Files 190 239 +49
Lines 18126 18909 +783
=============================================
+ Hits 13683 14297 +614
- Misses 4443 4612 +169
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Plugin builds for ad01cdd are ready 🛎️!
|
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.
Thanks for your work, @dhaval-parekh.
I left some feedback on the JS part.
From the functional point of view, everything seems to be working well.
753d87e
to
33c0dc1
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.
I'm noticing some inconsistencies with the notice in the panel body. Initially it renders above the video settings panel, but if I go to post settings and back to the block settings, it now renders below the video settings panel:
inconsistency.mov
@@ -305,6 +308,10 @@ private function filter_attributes( $attributes ) { | |||
} | |||
} | |||
|
|||
if ( isset( $out['autoplay'] ) ) { |
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.
A comment would be useful here to provide context. Also, we would only need to remove the muted
attribute when it is set, so $out['muted']
could be added as a condition here as well.
if ( isset( $out['autoplay'] ) ) { | |
// The amp-video will forcibly be muted whenever it is set to autoplay, so omit the | |
// `muted` attribute if it exists. | |
if ( isset( $out['autoplay'], $out['muted'] ) ) { |
So this has been a bug in Gutenberg for quite some time now: WordPress/gutenberg#15641. @dhaval-parekh @delawski any other workarounds in mind? Maybe we could show a post notice or an |
I've proposed a rather crude workaround in #6573 but maybe it's the way to go for now. Give it a try locally. |
…utoplay-2 Add muted message via direct DOM manipulation
…ute-when-autoplay * origin/develop: (35 commits) Remove redundant `object-fit=contain` from img elements Add test coverage for class appending Remove redundant object-fit=contain from video Set `amp-wp-unknown-size` class for videos without dimensions Update amp-toolbox-php to 0.7.0 Update tests to account for comments being stripped out Use `VisuallyHidden` for other screen reader texts Center chevron in toggle button Update test snapshots Use `VisuallyHidden` component to render hidden text Remove forced-disabling of SSR when Bento is enabled Update amp-toolbox-php to 7e63e5d Update test Update `translators` text Show a warning notice for featured image errors Add WebP and SVG as accepted image formats for a featured image Override `cleanupIDs` params instead redefining entire plugins list Update `svgo` config - prevent deprecation notices Test TikTok embed in Custom HTML block to fix missing coverage Update skip message for TikTok oEmbed conversion ...
|
||
let inspectorControls; | ||
|
||
if ( 'core/gallery' === name ) { | ||
inspectorControls = setUpGalleryInspectorControls( props ); | ||
} else if ( 'core/image' === name ) { | ||
inspectorControls = setUpImageInspectorControls( props ); | ||
} else if ( MEDIA_BLOCKS.includes( name ) || 0 === name.indexOf( 'core-embed/' ) ) { | ||
} else if ( 'core/video' === name ) { | ||
inspectorControls = isSelected ? VideoInspectorControls( props ) : null; |
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.
inspectorControls = isSelected ? VideoInspectorControls( props ) : null; | |
inspectorControls = isSelected ? VideoInspectorControls( props ) : setUpInspectorControls( props ); |
Still noticing the message being removed whenever the notice-disappear.mov |
Co-authored-by: Weston Ruter <[email protected]>
What I'll do is cherry-pick the PHP changes into a new PR which we'll include in 2.1.4 and then we can finish this up for 2.2. |
See #6581. |
…disable-mute-when-autoplay * 'develop' of github.com:ampproject/amp-wp: Fix video_with_autoplay test after #6576 Add test case for video with autoplay and muted on Update unit test case Remove mute attr from noscript video tag, and while autoplay is enable Place import in correct position Remove unnecessary constant Show a warning notice when there are validation errors for the featured image Update comments Simplify PrePublishPanel because we already applied filter to PostFeaturedImage Fix tests Keep featured image check in pre-publish panel after selected an image Add PostFeaturedImage to PrePublishPanel
I've looked into that issue and added E2E tests to cover this particular scenario (2ca8cc7). There doesn't seem to be an easy fix for that. The "Video settings" panel is rendered by the Video block's In our app, we're using the In our current implementation, we're reacting to the entire Video block sidebar changes. It works well in case a block is added, selected, or re-selected. However, we're completely unaware of any changes happening deeper in the app tree. What's more, since the panel's expanded/collapsed state is stored in the component's local state and not in the global data store, we won't be able to make use of the At this point, the only potential workaround I see is setting up a |
Should we just opt to contribute the notice improvement to Gutenberg core instead then? |
I'm not sure. From what I experienced so far, Gutenberg maintainers are not very keen on opening and extending the existing core APIs and blocks. I gave a Probably the last thing we would need is to do a stress test to see if the observer doesn't negatively affect the editor performance. |
Summary
Fixes #4635
Checklist