-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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] Refactor Caption component #19118
Conversation
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.
Here are some suggested test cases for this PR.
WordPress iOS:
- Simultaneous uploads - steps
- Image block - Insert image from device (failing) - steps
- Image block - Insert image from device (cancel) - steps
- Image block - Add Caption - steps
- Image block - Close/Re-open post with an ongoing image upload - steps
- Image block - Close post with an ongoing image upload - steps
- Image block - Switch to classic editor with an image block in page - steps
WordPress Android:
- Simultaneous uploads - steps
- Image block - Insert image from device (failing) - steps
- Image block - Insert image from device (cancel) - steps
- Image block - Add Caption - steps
- Image block - Close/Re-open post with an ongoing image upload - steps
- Image block - Close post with an ongoing image upload - steps
- Image block - Switch to classic editor with an image block in page - steps
WordPress iOS:
- Simultaneous uploads - steps
- Video block - Insert video from device (failing) - steps
- Video block - Insert video from device (cancel) - steps
- Video block - Add Caption - steps
- Video block - Close/Re-open post with an ongoing video upload - steps
- Video block - Close post with an ongoing video upload - steps
- Video block - Switch to classic editor with a video block in page - steps
WordPress Android:
- Simultaneous uploads - steps
- Video block - Insert video from device (failing) - steps
- Video block - Insert video from device (cancel) - steps
- Video block - Add Caption - steps
- Video block - Close/Re-open post with an ongoing video upload - steps
- Video block - Close post with an ongoing video upload - steps
- Video block - Switch to classic editor with a video block in page - steps
If you think that suggestions should be improved please edit the configuration file here. You can also modify/add test-suites to be used in the configuration.
If you are a beginner in mobile platforms follow build instructions.
const CAPTION_TAG_NAME = Platform.select( { | ||
ios: 'p', | ||
android: '', | ||
} ); |
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.
This was in the Gallery block to make it work correctly on Android due to the mentioned regression so I moved it to the Caption component itself since it was affecting the rest of Blocks using it.
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.
👍 Linking this up with the issue that was filed: wordpress-mobile/gutenberg-mobile#1651
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 like that this platform divergence is consolidated into one place, OTOH, it seems we currently have to "choose" between two regressions for all captions: Enter key not working or First word not style-able. This PR does not introduce these issues, but we do lose some granularity in how we can "choose which regression" 🙈 for the different use cases. I'm not suggesting a change here, just noting, and hopefully those issues will be resolved, and this will soon be a moot point. 😄
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.
Yeah you're right, by moving this to the Caption component it will affect Block level components with the First word not style-able regression, but it will allow users to add new lines on Android... I wonder what users use the most, styling in captions or entering new lines 😅
Completed some of the suggested test cases and all good ✅, skipped some not related to these changes. |
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.
Nice work @geriux ! I've left some minor comments. Overall, this looks pretty good. I've tested this out on Pixel 3a - Android 10, and everything is working well, aside from the known issue with styling the first word of the caption (not introduced by this PR).
packages/block-editor/src/components/block-caption/index.native.js
Outdated
Show resolved
Hide resolved
packages/block-editor/src/components/block-caption/index.native.js
Outdated
Show resolved
Hide resolved
const CAPTION_TAG_NAME = Platform.select( { | ||
ios: 'p', | ||
android: '', | ||
} ); |
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 like that this platform divergence is consolidated into one place, OTOH, it seems we currently have to "choose" between two regressions for all captions: Enter key not working or First word not style-able. This PR does not introduce these issues, but we do lose some granularity in how we can "choose which regression" 🙈 for the different use cases. I'm not suggesting a change here, just noting, and hopefully those issues will be resolved, and this will soon be a moot point. 😄
…ssing accessibility label for the Video block's caption
Hi @mkevins 👋 I've updated the PR with the changes from your feedback 😃. I also added the accessibility label for the Video block's caption that was missing. By the way, I saw that for the images within the gallery we are setting the accessibility label like this ->
Would it make sense to move it to the Thanks! |
Hey @geriux 👋 I've tested again with the changes, and everything still works as before. Nice work!
I tried that on Android, and it seemed to be ok, but I haven't had a chance to check on iOS. Since the comment specifically mentions addressing a VoiceOver issue for iOS, perhaps it's best to leave it for now. The intent here is to treat an unselected |
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 had to locally merge with latest (gutenberg:master and gutenberg-mobile:develop) to the respective branches for these PRs due to an intermittent dependency issue, but after that, everything is working nicely. Nice work @geriux 👍 . After updating to latest, LGTM!
Awesome! Thanks for testing it! |
Hey @pinarol ! This is ready to be merged but I want to double check this https://github.com/WordPress/gutenberg/pull/19118/files/865739561806ba1a735f161d40df17f935ddf00c#diff-fb4bb656dce8b784120b171a9b46cbcaR12-R17 first. TL;DR With these changes we'll have one regression for captions (only on Android) which is that the first word can't be styled because we are not setting the Currently, for (Android) we have two regressions in captions:
What do you think? Should we merge and have just one regression for all captions? Or wait until those bugs are fixed? |
@geriux So we need to choose between bugs :) I gave it a try and I think not being able to style feels more buggy than not being able to enter a new line. When I select the whole sentence and try to apply a style it is simply not responding. So I'd go with sacrificing the ability to add a new line. Plus, I don't expect multiple line captions are that common. |
Sounds good! I agree with multiple line captions not being that common, awesome! I'll update it then =) Thank you! |
Hi @geriux 👋 This looks good to merge. Nice work! |
Gutenberg-mobile
PR -> wordpress-mobile/gutenberg-mobile#1678Description
Our current
Caption
component implementation was meant to be within a block level component, but now there are cases where we just want to use the Caption UI like in the Gallery block.So this PR adds a new component
BlockCaption
that will have the current logic wrapping aCaption
component which will only have the UI.How has this been tested?
Types of changes
Refactor
Checklist: