Skip to content
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

Issue 6390 - Fixes emoji positioning #6766

Merged
merged 3 commits into from
Dec 16, 2021

Conversation

sidferreira
Copy link
Contributor

@sidferreira sidferreira commented Dec 15, 2021

Details

This issue addresses some positioning issues for emojis in iOS.
Some changes affects other platforms, but minor changes.

Fixed Issues

$ #6390

Tests

QA Steps

To test: App/src/pages/home/HeaderView.js

Needs a default room, with a subtitle.
Look at the room subtitle.
Emoji should be fully visible, no positioning change on other platforms.
Adding/removing the emoji should not change the text position.

To test: App/src/pages/ReportDetailsPage.js

Needs a default room, with a subtitle.
Go to the room details.
Emoji should be fully visible, the component had height: 16px; paddingBottom: 24px; now it has height: 20px; paddingBottom: 20px;.
The text is basically ~4px lower with this.
Adding/removing the emoji should not change the text position.

To test: App/src/pages/home/sidebar/OptionRow.js

Go to a chat, send an emoji
Go back to chat list
Emoji should be fully visible, the description component had height: 16px; paddingTop: 4px; now it has height: 20px; paddingTop: 0px;.
The text moves a ~1px up with the change.
Adding/removing the emoji should not change the text position.

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

App/src/pages/home/HeaderView.js

Platform Before After
App iOS EMOJI_HEADER_BEFORE_APP_IOS EMOJI_HEADER_AFTER_APP_IPHONE
App Android EMOJI_HEADER_BEFORE_APP_ANDROID EMOJI_HEADER_AFTER_APP_ANDROID
Mobile Safari EMOJI_HEADER_BEFORE_MOBILE_SAFARI EMOJI_HEADER_AFTER_MOBILE_SAFARI
Mobile Chrome EMOJI_HEADER_BEFORE_MOBILE_CHROME EMOJI_HEADER_AFTER_MOBILE_CHROME
Desktop EMOJI_HEADER_BEFORE_DESKTOP EMOJI_HEADER_AFTER_DESKTOP
Web Chrome EMOJI_HEADER_BEFORE_WEB_CHROME EMOJI_HEADER_AFTER_WEB_CHROME
Web Safari EMOJI_HEADER_BEFORE_WEB_SAFARI EMOJI_HEADER_AFTER_WEB_SAFARI

App/src/pages/ReportDetailsPage.js

Platform Before After
App iOS EMOJI_DETAILS_BEFORE_APP_IOS EMOJI_DETAILS_AFTER_APP_IPHONE
App Android EMOJI_DETAILS_BEFORE_APP_ANDROID EMOJI_DETAILS_AFTER_APP_ANDROID
Mobile Safari EMOJI_DETAILS_BEFORE_MOBILE_SAFARI EMOJI_DETAILS_AFTER_MOBILE_SAFARI
Mobile Chrome EMOJI_DETAILS_BEFORE_MOBILE_CHROME EMOJI_DETAILS_AFTER_MOBILE_CHROME
Desktop EMOJI_DETAILS_BEFORE_DESKTOP EMOJI_DETAILS_AFTER_DESKTOP
Web Chrome EMOJI_DETAILS_BEFORE_WEB_CHROME EMOJI_DETAILS_AFTER_WEB_CHROME
Web Safari EMOJI_DETAILS_BEFORE_WEB_SAFARI EMOJI_DETAILS_AFTER_WEB_SAFARI

App/src/pages/home/sidebar/OptionRow.js Most Recents

Platform Before After
App iOS EMOJI_RECENT_BEFORE_APP_IOS EMOJI_RECENT_AFTER_APP_IPHONE
App Android EMOJI_RECENT_BEFORE_APP_ANDROID EMOJI_RECENT_AFTER_APP_ANDROID
Mobile Safari EMOJI_RECENT_BEFORE_MOBILE_SAFARI EMOJI_RECENT_AFTER_MOBILE_SAFARI
Mobile Chrome EMOJI_RECENT_BEFORE_MOBILE_CHROME EMOJI_RECENT_AFTER_MOBILE_CHROME
Desktop EMOJI_RECENT_BEFORE_DESKTOP EMOJI_RECENT_AFTER_DESKTOP
Web Chrome EMOJI_RECENT_BEFORE_WEB_CHROME EMOJI_RECENT_AFTER_WEB_CHROME
Web Safari EMOJI_RECENT_BEFORE_WEB_SAFARI EMOJI_RECENT_AFTER_WEB_SAFARI

App/src/pages/home/sidebar/OptionRow.js Focus (avoid regression)

Platform Before After
App iOS EMOJI_FOCUS_BEFORE_APP_IOS EMOJI_FOCUS_AFTER_APP_IOS
App Android EMOJI_FOCUS_BEFORE_MOBILE_ANDROID EMOJI_FOCUS_AFTER_APP_ANDROID
Mobile Safari EMOJI_FOCUS_BEFORE_MOBILE_SAFARI EMOJI_FOCUS_AFTER_MOBILE_SAFARI
Mobile Chrome EMOJI_FOCUS_BEFORE_MOBILE_CHROME EMOJI_FOCUS_AFTER_MOBILE_ANDROID
Desktop EMOJI_FOCUS_BEFORE_DESKTOP EMOJI_FOCUS_AFTER_DESKTOP
Web Chrome EMOJI_FOCUS_BEFORE_WEB_CHROME EMOJI_FOCUS_AFTER_WEB_CHROME
Web Safari EMOJI_FOCUS_BEFORE_WEB_SAFARI EMOJI_FOCUS_AFTER_WEB_SAFARI

@sidferreira sidferreira marked this pull request as ready for review December 15, 2021 01:51
@sidferreira sidferreira requested a review from a team as a code owner December 15, 2021 01:51
@MelvinBot MelvinBot removed the request for review from a team December 15, 2021 01:51
@sidferreira sidferreira changed the title Sidferreira/issue 6390 Issue 6390 - Fixes emoji positioning Dec 15, 2021
Comment on lines 1 to 3
export default {
paddingTop: 19,
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From #6390 (comment).
We should try to avoid using styles specific to platforms. Try to generalize the styles so that they look good on each platform.

This change affects only IOS creating inconsistency across platforms. Also, this is a big design decision and thus I will ask someone to review this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default padding top is 23, I'll move it to the file for clarity. @parasharrajat

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I had to do similar in another issue related to emojis

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@parasharrajat parasharrajat Dec 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I forgot to mention that at that time but there, UI was not affected. The text was vertically aligned on all platforms and here the gap is not equal.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you help me understand what this change does, and how it helps us fix the issue that is being addressed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@parasharrajat gotcha

@shawnborton long story short, emojis on iOS display a bit larger ( #6390 (comment) ) and require some extra pixels to display it properly. The input has height: 100%; paddingBottom: 8; paddingTop: 23, and the parent has height: 50, so, the usable height for the input is 19, but as the input has fontSize: 15, it needs 4 extra pixels to render the emoji properly, that's why changing paddingTop: 23 to paddingTop: 19 address the issue.

We can also use paddingBottom: 6; paddingTop: 21 to try to keep it a bit more at center...

},

expensiTextInputAndIconContainer: {
zIndex: -1,
flexDirection: 'row',
height: '100%',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be breaking Multiline input. Could you test it and share a clip of that with me?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@parasharrajat I tested Web Safari and App iOS and it was alright. I'll run screenshots once we settle the requested changes...

@parasharrajat
Copy link
Member

@shawnborton This PR is changing the padding for TextInputs across the app to paddingTop: 19px. Could you please check the screenshots and tell us if this is fine?

@shawnborton
Copy link
Contributor

I don't understand why the text input components are being touched when this issue is about fixing how emojis display in the chats list. Can someone help me understand? Thanks!

@parasharrajat
Copy link
Member

parasharrajat commented Dec 15, 2021

@shawnborton This also affects the TextInput and Emojis are cropped on TextInput in IOS too. #6390 (comment).

Scope was extended.

@shawnborton
Copy link
Contributor

Just to clarify, how did that scope get added here? Seems like that should be a separate project?

@shawnborton
Copy link
Contributor

Okay looks like it was discussed to group these together in the issue, cc @roryabraham

@@ -1111,8 +1114,8 @@ const styles = {
},

optionAlternateText: {
height: 16,
lineHeight: 16,
height: 20,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how I feel about this change. Right now, we have the user name/email set to be 20px tall, then a 4px margin, then the alternate text is 16px. This gives us 20 + 4 + 16 = 40px, which sits perfectly next to the 40px tall avatar. Can you make sure we get this same kind of evenness with these proposed changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shawnborton the margin was removed, as discussed in #6390 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sidferreira could you please expand on Shawn's comment. We want to be sure from a design perspective.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quoting from the link:

To fix this, we need to tweak optionAlternateText in 3 places:

Use case 1

<ExpensifyText
style={[
styles.sidebarLinkText,
styles.optionAlternateText,
styles.textLabelSupporting,
styles.mt1,
]}
numberOfLines={1}
>

Use case 2

: [textStyle, styles.optionAlternateText, styles.textLabelSupporting, styles.mt1];

Have a total height 20 as the component height is 16 and mt1 is 4.

Use case 3

<ExpensifyText
style={[
styles.sidebarLinkText,
styles.optionAlternateText,
styles.textLabelSupporting,
styles.mb6,
]}
numberOfLines={1}
>

Has a total height 40 as the component height is 16 and mt6 is 24

So, my suggestion is to:
A) change optionAlternateText to have lineHeight/height: 20, behaving kinda like mt1 by default
B) Remove mt1 from use cases 1 and 2
C) Change mb6 to mb5 in use case 3

This change will make sure that all items keep their designed heights but allow space to emoji wherever is needed.

@sidferreira
Copy link
Contributor Author

Just to clarify, how did that scope get added here? Seems like that should be a separate project?

@shawnborton yeah, @parasharrajat and I wondered if we should split it or not, but sounded smaller than turned into...

@parasharrajat
Copy link
Member

Well, as mentioned "Well, I am not yet sure of the best solution to fix it. I would have to dig into the code for that. But I would say that this is additional to the main issue so we can still proceed with the main issue and fix all the know issues and think about the input later in detail. I will report the issue separately and then we can explore there."

I think it's better to split the Textinput issue into a separate one. So I am reporting it on Slack.
we can proceed with the rest of the issues.
is it fine? @roryabraham @sidferreira

@sidferreira
Copy link
Contributor Author

@parasharrajat @roryabraham @shawnborton revered input changes

Copy link
Contributor

@roryabraham roryabraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all seems fine to me, but let's see what @shawnborton thinks

@parasharrajat
Copy link
Member

Awaiting Shawn's input before final review.

@shawnborton
Copy link
Contributor

I think this looks good to me, thanks!

@roryabraham roryabraham merged commit f6b139c into Expensify:main Dec 16, 2021
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@sidferreira sidferreira deleted the sidferreira/issue_6390 branch December 16, 2021 21:38
@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @roryabraham in version: 1.1.21-2 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@mvtglobally
Copy link

@roryabraham @sidferreira @parasharrajat How can we create default room, with a subtitle?
When we select new room There is no "subtitle" option.
Screen Shot 2021-12-17 at 5 26 22 PM

@sidferreira
Copy link
Contributor Author

@mvtglobally for development purposes I forced those cases, I'm not sure how to create it as well... It seems to require admin rights or something...

@roryabraham
Copy link
Contributor

@mvtglobally since:

  1. That's not yet a mainline use-case
  2. @sidferreira verified that case on dev
  3. All the others are a pass

I think that gives me enough confidence to check this off and run the deploy.

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @sketchydroide in version: 1.1.22-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants