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

PR 3: Adding EmojiPicker to the Edit Comment #7580

Merged

Conversation

mananjadhav
Copy link
Collaborator

@mananjadhav mananjadhav commented Feb 5, 2022

Details

Fixed Issues

$ #3245

Tests

  1. Tested the EmojiPicker on Composer
  2. Tested frequently used emojis
  3. Tested skintone for emojis
  4. Tested searchInput focus for EmojiPicker on Load
  5. Tested scroll for EmojiPicker (had issues with earlier implementation)
  6. Closing EmojiPicker doesn't shift the focus to the edit comment
  7. EmojiPicker positioning switching between Edit comment and Composer
  • Verify that no errors appear in the JS console

QA Steps

  1. Go to any chat
  2. Select any own message
  3. Click on Edit Comment
  4. You'll see an Emoji icon and click on the icon
  5. Select your emoji, and ensure that it gets entered into the comment.
  • Verify that no errors appear in the JS console

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

web-edit-emoji-picker

Mobile Web

mweb-edit-emoji-picker

Desktop

desktop-edit-emoji-picker

iOS

ios-edit-emoji-picker

Android

android-edit-emoji-picker

@mananjadhav mananjadhav requested a review from a team as a code owner February 5, 2022 00:37
@MelvinBot MelvinBot requested review from parasharrajat and puneetlath and removed request for a team February 5, 2022 00:37
@mananjadhav
Copy link
Collaborator Author

@parasharrajat for ReportActionCompose, there's this code on componentDidUpdate

if (this.shouldFocusInputOnScreenFocus && this.props.isFocused
    && prevProps.modal.isVisible && !this.props.modal.isVisible) {
    this.focus();
}

It seems you're the code owner. I can't find how isFocused as passed as props and need some help in understanding the props.modal.

What is happening is, after I close EmojiPicker on any edit comment, it calls this componentDidUpdate of composer and focuses the compose input.

@parasharrajat
Copy link
Member

Ok. I see. I will tell you what is the use of it and how to manage this when I will review the PR.

I am waiting on the first PR to be merged. We will go step by step.

…moji-picker-in-edit-message

# Conflicts:
#	src/pages/home/report/ReportActionCompose.js
#	src/pages/home/report/ReportActionItemMessageEdit.js
…moji-picker-in-edit-message

# Conflicts:
#	src/components/EmojiPicker/EmojiPickerButton.js
src/pages/home/report/ReportActionItemMessageEdit.js Outdated Show resolved Hide resolved
src/pages/home/report/ReportActionItemMessageEdit.js Outdated Show resolved Hide resolved
src/pages/home/report/ReportActionItemMessageEdit.js Outdated Show resolved Hide resolved
src/pages/home/report/ReportActionItemMessageEdit.js Outdated Show resolved Hide resolved
src/pages/home/report/ReportActionItemMessageEdit.js Outdated Show resolved Hide resolved
src/pages/home/report/ReportActionItemMessageEdit.js Outdated Show resolved Hide resolved
src/pages/home/report/ReportActionItemMessageEdit.js Outdated Show resolved Hide resolved
@parasharrajat
Copy link
Member

Pending: Closing EmojiPicker doesn't shift the focus to the edit comment.

For this, you can use shouldSetModalVisibility flag. If you set this to false, the focus is not set to the composer when the modal is closed.

Now, you can set the focus back to editbox same as

() => InteractionManager.runAfterInteractions(() => this.textInput.focus()),

@puneetlath puneetlath requested review from Julesssss and removed request for puneetlath March 4, 2022 20:37
@parasharrajat
Copy link
Member

Any update on PR?

@mananjadhav
Copy link
Collaborator Author

@parasharrajat @Julesssss PR updated with the feedback and bugs resolved. Can you please review it?

@@ -79,6 +79,7 @@ class EmojiPicker extends React.Component {

this.emojiPopoverAnchor.measureInWindow((x, y, width) => this.setState({
emojiPopoverAnchorPosition: {horizontal: x + width, vertical: y},
isEmojiPickerVisible: true,
Copy link
Member

@parasharrajat parasharrajat Mar 9, 2022

Choose a reason for hiding this comment

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

This could be a problem and this is an extra render. measureEmojiPopoverAnchorPosition is tied to Dimensions Change event and thus we should not do this here. But you can use this method to get the dimensions

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had earlier not done it here if you see, I want the picker to be visible after the anchor position is calculated. With the earlier case, I faced this issue #3245 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

Yup. I saw that.

But you can use this method to get the dimensions
Use this method to get dimensions only. Then where you are opening the picker and set the dimensions on state. Then create another method that will also get the dimensions from it and update the state. This new method will be used in Dimensions change.

@parasharrajat
Copy link
Member

Any update @mananjadhav ?

@mananjadhav
Copy link
Collaborator Author

Working on it today. Can you confirm the state change is the only change and no other changes?

@parasharrajat
Copy link
Member

Yup. Rest looks good to me.

@mananjadhav
Copy link
Collaborator Author

@parasharrajat PR updated

@parasharrajat
Copy link
Member

@mananjadhav Could you please merge the main? I am testing it now. Sorry for the delay.

@parasharrajat
Copy link
Member

@shawnborton is the margin correct for picker icon?
image

Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

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

LGTM but awaiting design review.

@mananjadhav
Copy link
Collaborator Author

@mananjadhav Could you please merge the main? I am testing it now. Sorry for the delay.

Done.

@parasharrajat
Copy link
Member

parasharrajat commented Mar 23, 2022

@Expensify/design is the margin correct for picker icon from edges of Edit box? There is an equal gap on the left and right sides of the emoji icon.
image

@megankelso
Copy link

that looks a bit too narrow to me, I would increase it some.

@michelle-thompson
Copy link
Contributor

Agree with Megan. Also it doesn't look centered through the middle? General rule of thumb, margins on top, bottom, and sides, should look the same.

@mananjadhav
Copy link
Collaborator Author

mananjadhav commented Mar 23, 2022

I'll fix the margin-right, in the edit mode, but vertical alignment looks fine as far as I can see. Here's the screenshot for edit and create mode. I used the same style, will 3px more on the right be fine?

Screenshot 2022-03-23 at 11 46 44 PM

Updated Margin
Screenshot 2022-03-24 at 12 00 09 AM

@parasharrajat @michelle-thompson @megankelso

Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

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

LGTM.

cc: @Julesssss

PR Reviewer Checklist

  • I verified the PR has a small number of commits behind main
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the testing environment is mentioned in the test steps
  • I verified testing steps cover success & fail scenarios (if applicable)
  • I checked that screenshots or videos are included for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • I verified there are no console errors related to changes in this PR
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified comments were added when the code was not self explanatory
    • I verified any copy / text shown in the product was added in all src/languages/* files (if applicable)
    • I verified proper naming convention for platform-specific files was followed (if applicable)
    • I verified style guidelines were followed
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components are not impacted by changes in this PR (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified the UI performance was not affected (the performance is the same than main branch)
  • If a new component is created I verified that a similar component doesn't exist in the codebase

🎀 👀 🎀 C+ reviewed

@Julesssss
Copy link
Contributor

Tests well, better emoji support than Github! 👍 😎 🥇 ☕

@Julesssss Julesssss merged commit e7565c1 into Expensify:main Mar 30, 2022
@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.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @Julesssss in version: 1.1.47-0 🚀

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

@OSBotify
Copy link
Contributor

OSBotify commented Apr 5, 2022

🚀 Deployed to production by @roryabraham in version: 1.1.49-1 🚀

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

<View style={styles.editChatItemEmojiWrapper}>
<EmojiPickerButton
isDisabled={shouldDisableEmojiPicker}
onModalHide={() => InteractionManager.runAfterInteractions(() => this.textInput.focus())}
Copy link
Contributor

Choose a reason for hiding this comment

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

Coming from #30119

If, at the beginning, a composer's emoji picker is open, opening some other emoji picker results in a race:

  • Here, we focus the composer because the original emoji picker hides
  • The other emoji picker focuses its search field

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.

7 participants