-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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] Image Block: Improve Text Entry for Long Alt Text #29670
[RNMobile] Image Block: Improve Text Entry for Long Alt Text #29670
Conversation
With this commit, a new AltTextSettings component has been introduced to replace the current TextControl that exists for entering an image's Alt text. This new component makes use of BottomSheet.SubSheet, so that users are taken to a new subsheet when entering alt text.
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @SiobhyB! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
The current text in the alt text subsheet's footer doesn't meet WordPress' accessibility standards for colour contrast. This commit updates the colour from " $gray-30" to "$gray-text-min" in order to meet those standards.
Marking as ready for review. :) As well as being keen to hear comments/suggestions on the overall approach I took to address this issue, I'm also curious about the following:
Thanks in advance! |
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 is looking solid, functionally it's working great (and I see the alt
attribute in the editor's HTML). I have some comments to share about the styles (comparing to the design here):
Bottom margin too small
When adding alt text, on iOS the margin in-between the text and the horizontal line below looks too tight (some letters almost touch the line). On Android the margin actually looks too big.
iOS | Android |
---|---|
Horizontal line and color
On both iOS and Android, the horizontal line color looks a bit off (especially in dark mode) when comparing to other places in the app (like Cover block bottom sheet):
Image alt text on iOS | Cover block on iOS |
---|---|
Text size and color
Looking at the example design here, the text side and color for the "Describe the.." string seems a bit different here. I'm not sure if @iamthomasbishop specified a particular text size that he'd like, but we could probably reduce it a little.
Dark mode
On iOS and Android the text stays black on the dark background in my tests:
Just regarding this, it looks like the |
Nice work so far, @SiobhyB! 👏 Happy to see this in the works! I think @guarani can lend a better hand with implementing/matching colors, but I'll try to clarify some things regarding sizing/spacing:
That's right, I believe I used the section footer component in Figma, which we're using various places (i.e. Columns block settings). I can't recall if we have the exact thing as a structured component yet, but it looks like this: Let me clarify what I was imagining for padding/sizing of the text area. If we use the main cell component as a staring point, and expand the text label area downward, we would have something like this: I'm not sure if the |
This commit increases the min-height of "altTextEditor" so that the editor is a larger height on iOS devices by default.
This commit updates the component's border colours to match similar separators/borders throughout the app. "light-gray-400" is used for light mode and "gray-70" for dark mode.
This commit fixes a bug, where text entered in iOS appear black on black (therefore, unreadable) in dark mode.
With this commit, I've tweaked the font size and padding around the "altTextSetting" compont's footer note to more closely match up with the initial design.
This commit fixes a bug I spotted while testing, where it's possible to continue hitting "enter" and increasing the size of the editor without limitless, leading to the footer note being dragged off screen.
This commit increase the padding at the bottom of the footer note, in accordance with the design.
This commit updates the colour of the default placeholder text in the "AltTextSettings" component's TextInput. The purpose of defining this is to fix a bug in iOS, where the placeholder text appeared as black on black in dark mode.
Two small changes to the "Alt Text Settings" components are included in this commit. The first increases the padding of the footnote to match the design and the second aligns the placeholder text to the top, which is necessary for Android devices.
@guarani, @iamthomasbishop, thanks so much for the help here. 🙇♀️ I've made updates to change the styles, based on your feedback, and have taken screenshots of the results below. iOS
Android
NotesI found that the |
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 made a guess at the colours, based on the _colors.native.scss file and also updated the initial colour I chose for the settings to meet WordPress' accessibility standards. Is there a better approach for determining the colours that should be used based on the design?
I think your approach here is what I've used. Just want to mention that depending on what kind of changes are included in a PR, an installable build can be made for WPiOS and WPAndroid. If this is something that you'd like @iamthomasbishop, I'm available to help show you @SiobhyB how to make those.
Regarding the question of whether we should be using TextareaControl
instead of a plain TextInput
, I have no strong feelings either way. The code looks good and I've tested both platforms so this is about done. What's left from my perspective is to add a note to the change log here: https://github.com/WordPress/gutenberg/blob/trunk/packages/react-native-editor/CHANGELOG.md
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 Looking pretty close, for sure! I dug in a bit more and have a few questions/bits of feedback, which I'll try to find/drop inline.
Changes the font-size of the footnote from 13px to 12px, based on feedback.
This commit sets a defined height of 80px for the altTextEditor component, in response to feedback and to remove complexity around the box expanding when text is entered.
The colour of the link is updated for both light and dark mode with this commit, based on feedback received.
@enejb, this makes a lot of sense, thank you for the note! I've gone ahead to convert this to a more generic
I've also gone ahead to create a README.md now. :) @enejb, @guarani, when you have a chance, I'd be really grateful for your eyes on these changes. Thank you again for all the help and input you've already provided. 🙇♀️ |
Thanks for changes @SiobhyB and adding the documentation! ❤️ I wonder the current Instead of passing in 3 different variables. We could pass in a single This way in case we want to add 2 links for example or it would work out nicer. Also if we do take this approach a bit further we might also want to create a very simple (Maybe this is taking things too far) But in the end we would end up with something like.
This way if we add footer notes to other bottom sheet control components they would all be the same styles. What do you think? |
This commit seeks to simplify the BottomSheetTextControl component by splitting out two more, smaller components from it: 1. smallFooterMessageControl 2. smallFooterMessageControlLink
Thank you again @enejb, this makes total sense and is a really valuable lesson for me to be mindful about "future-proofing" changes. :) I've split out two smaller components to make this more re-usable: Let me know if this looks okay to you! |
Thanks for working on this. I have some more suggestions here :)
cc @iamthomasbishop Can we align the two footer message components to always be the same? The previous one is currently only being used in the columns component as well as the columns picker component. See (currently it looks like this) If we applied the same new footer style (new colour, fontsize and alignment) If we want to stick with the 2 different variations for now let's add the new one by passing in the correct attributes/props to the previous
This helps developers choose the right component in the future since there will be only one :)
could be rewritten to be
This way the
|
This commit updates the name of "SmallFooterMessageLinkControl" to "FooterMessageLink" in order to be clearer and more readable.
This commit updates the name of "SmallFooterMessageLinkControl" to "FooterMessageLink" in order to be clearer and more readable.
Thanks again for your help! I've implemented the following from your list:
And am either working on or have some follow up questions on the following:
|
This commit moves FooterMessageLink to a separate folder for the purpose of adding a README
This reverts an accidental commit, where I'd made changes in "link-settings/index.native.js" as part of general testing. I also remove "textAlign="left"" from a FooterMessageControl component in this file, as this is now the default.
Following a chat with @iamthomasbishop, I've gone ahead to complete the following:
Android:
iOS:
New issues created following the discussions here:
@enejb, could I bother you for another review, please? Thank you in advance. 🙇♀️ |
Nicely done @SiobhyB! I tested this on the android and ios simulators and it worked well for me. (lite and dark modes) |
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 This is looking good, just one tiny thing I noticed in your last round of screenshots. It looks like the text label might be getting clipped by the container boundary:
@iamthomasbishop, thanks for your review! I spent a bit of time looking into this and it appears to be Android-specific, with the bottom parts of some text being visible at the top when multiple lines are added. I couldn't find a quick fix, as testing will be required across different size screens in both iOS and Android, but have created a new GitHub issue for this: #30457 Do you think it'd be okay to merge this PR and then I'll work on that issue separately when I'm back from AFK? |
@SiobhyB That's fine, thank you! |
Oops, I mixed up two different efforts, there are no bridge changes in this one so, will go ahead and merge (and update+merge the gutenberg-mobile PR too). Thanks for the work here @SiobhyB! |
Fixes: wordpress-mobile/gutenberg-mobile#922
gutenberg-mobile
: wordpress-mobile/gutenberg-mobile#3236Description
With this PR, a new
AltTextSettings
component has been introduced to replace the currentTextControl
that exists for entering an image's Alt text. This new component makes use ofBottomSheet.SubSheet
so that users are taken to a new subsheet when entering alt text.The end goal is to provide a better experience for users who are entering a longer alt text for their images, as the current text entry has limited room/options for scrolling.
How has this been tested?
The general steps for testing, for both iOS and Android, are as follows:
As this is a UI change, dark mode and landscape orientation are also considerations when testing.
Screenshots
Types of changes
Non-breaking change. No additional functionality is introduced beyond UI enhancement.
Checklist: