-
Notifications
You must be signed in to change notification settings - Fork 798
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
RNMobile: Ensure playsInline
attribute conforms when falling back to core Video block
#35981
RNMobile: Ensure playsInline
attribute conforms when falling back to core Video block
#35981
Conversation
Co-Authored-By: Carlos Garcia <[email protected]>
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped. Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
playsInline
setting confirms to core VideoplaysInline
setting conforms when falling back to core Video block
playsInline
setting conforms when falling back to core Video blockplaysInline
attribute conforms when falling back to core Video block
@Automattic/jetpack-crew, as we're proposing a change to web file here, I'd be grateful for your review. 🙇♀️ |
I tried testing this and had slightly unexpected results. Not sure if I'm testing it right, though. Can you reproduce this behavior? |
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.
@SiobhyB I confirmed that with this change wordpress-mobile/gutenberg-mobile#6671 can't be reproduced. However, I noticed that blocks created previous to this change result in a block validation error.
I presume that we shouldn't change the block's markup without adding a deprecation to the block.
Regarding the web version, I couldn't reproduce this case but this seems expected as the VideoPress v5 is not registered if VideoPress is disabled. Apart from this, seems there are no regressions in the web. In any case, I'd defer the approval of that part to the Jetpack crew.
Ah, interesting, I was testing for that but didn't run into the error. We should definitely add deprecation handling then 👍 |
@fluiddot, were those blocks created based on the changes in #35637? If so, those changes aren't yet shipped to users, so I'm wondering if there would be a case where users would actually run into what you've described. 🤔 |
Yes, the blocks I tested were created based on the changes in #35637.
Good point. If this change will be released along with #35637, then what I mentioned shouldn't be an issue. Tomorrow we are releasing a new Gutenberg Mobile version (which will include #35637), so if we merge this today we'll be on time to have both. That said, I'll proceed with approving the PR, thanks 🙇 ! |
@bindlegirl, thank you for testing!
Were you testing the app locally (with these changes applied) or with a production build? I tested with these changes checked out in both the app and web, but wasn't able to reproduce what you're describing: playsinline.mov |
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.
LGTM 🎊 !
I'll go ahead to merge based on the above and then incorporate this into Gutenberg Mobile for tomorrow's release. @bindlegirl let me know if you're able to consistently reproduce the issue you were running into with the local changes from the app (or when this is released in 24.4). I'll also be keeping an eye out for reports when the change is released to users. 🙇♀️ |
@SiobhyB This is what I see when testing on web (the inline toggle is set to off when reopening the post): Screen.Recording.2024-02-28.at.17.29.19.movAs far as I can tell, saving in app, and opening in web editor works as expected. It could be a problem with my testing environment if you are unable to reproduce it. Or with my testing procedure. 🙂 |
@bindlegirl, ah I see, thank you for elaborating! My testing was focused on the app, if I check now I can confirm I can reproduce what you're seeing on Atomic sites that have VideoPress enabled on the web. I'll create a separate PR to revert these changes. |
I've got the revert PR up in #36030. @bindlegirl, thank you for spotting! I was eager to get a potential fix into the app's next release, which is why I kind of rushed merging, but should have looked more carefully into your first comment. Thank you again for following up! We'll have to come up with another solution for the app bug but the setting has always been broken on mobile, so this isn't a regression for us. We can wait to address in another release. |
Good catch @bindlegirl! I checked the block's attributes in the case shared #35981 (comment), and noticed that the block has both diff --git forkSrcPrefix/projects/plugins/jetpack/extensions/blocks/videopress/save.js forkDstPrefix/projects/plugins/jetpack/extensions/blocks/videopress/save.js
index a731b3ea65c298e0ecf9a99014436e16dcd89fb8..65e9c17e614ac1ae04eb8eef9fcb1529ab57f8bb 100644
--- forkSrcPrefix/projects/plugins/jetpack/extensions/blocks/videopress/save.js
+++ forkDstPrefix/projects/plugins/jetpack/extensions/blocks/videopress/save.js
@@ -42,9 +42,18 @@ const VideoPressSave = CoreVideoSave => props => {
* @see https://github.com/WordPress/gutenberg/blob/c5f9bd88125282a0c35f887cc8d835f065893112/packages/editor/src/hooks/generated-class-name.js#L42
* @see https://github.com/Automattic/wp-calypso/pull/30546#issuecomment-463637946
*/
- // Rename `playsinline` to `playsInline` to conform the block schema of core Video block.
- const { playsinline: videoPressPlayinline, ...restAttributes } = props.attributes;
- const coreVideoAttributes = { ...restAttributes, playsInline: playsinline };
+ // Due to different naming for the Plays inline setting between this block and core Video block, and potentially
+ // having both defined in block's attributes. We need to determine which value should be used and ensure we use
+ // the `playsInline` attribute defined by the core Video block, as it's the block that ultimately will be rendered.
+ const {
+ playsinline: videoPressPlayinline,
+ playsInline: corePlayinline,
+ ...restAttributes
+ } = props.attributes;
+ const coreVideoAttributes = {
+ ...restAttributes,
+ playsInline: corePlayinline || videoPressPlayinline,
+ };
return CoreVideoSave( {
...props, cc @SiobhyB |
@fluiddot, the solution you proposed seems promising! I would be happy to help review if anyone picks up a PR. I'm working on the release today ahead of my support rotation and, as this isn't regression, won't prioritise working on it myself. |
Fixes wordpress-mobile/gutenberg-mobile#6671
Description:
The core Video and VideoPress v5 blocks use different capitalisation for the "plays inline" setting:
playsInline
playsinline
Due to various technical limitations that arise from working with the app, the native implementation of VideoPress v5 in #35637 assigns the
playsinline
attribute when the block is added to Atomic sites, even those without VideoPress enabled. As described in wordpress-mobile/gutenberg-mobile#6671, this leads to the setting not working as expected for Atomic sites w/o Jetpack when changed within the app.Proposed changes:
playsinline
toplaysInline
when falling back to the core Video block. This will ensure the correctly capitalised setting is always used with the core block.Other information:
Jetpack product discussion
N/A
Does this pull request change what data or activity we track or use?
No, it does not.
Testing instructions: