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

[$250] mWeb - Chat - Before emoji picker box opens, a seperate compose box with cursor is shown briefly #40461

Closed
1 of 6 tasks
lanitochka17 opened this issue Apr 18, 2024 · 21 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Monthly KSv2 Reviewing Has a PR in review

Comments

@lanitochka17
Copy link

lanitochka17 commented Apr 18, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 1.4.63
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4499507
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to https://staging.new.expensify.com/home
  2. Tap on a report
  3. Tap emoji picker in compose box
  4. Select an emoji
  5. Note size of emoji in compose box is bigger compare to production
  6. Select one more emoji
  7. Send the message
  8. Long press the sent message amd tap edit comment
  9. Tap emoji picker from edit compose box

Expected Result:

Before emoji picker box opens, a separate compose box with cursor must not be shown briefly while edit comment

Actual Result:

Before emoji picker box opens, a separate compose box with cursor is shown briefly while edit comment

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6453358_1713428958074.edit.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01030e7a0cab136f03
  • Upwork Job ID: 1782524877291671552
  • Last Price Increase: 2024-04-22
  • Automatic offers:
    • s77rt | Reviewer | 0
    • bernhardoj | Contributor | 0
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Apr 18, 2024
Copy link

melvin-bot bot commented Apr 18, 2024

Triggered auto assignment to @puneetlath (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@lanitochka17
Copy link
Author

@puneetlath FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@lanitochka17
Copy link
Author

We think that this bug might be related to #vip-vsp

@bernhardoj
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

The main composer is shown when opening the edit composer emoji picker.

What is the root cause of that problem?

When we focus on an edit composer, the main composer will be hidden. But when the edit composer is blurred, the main composer will shown again. In this case, when we press the emoji picker button, the edit composer will be blurred.

But actually, we already prevent the main composer from showing when we press the emoji picker button as shown here.

onBlur={(event: NativeSyntheticEvent<TextInputFocusEventData>) => {
setIsFocused(false);
// @ts-expect-error TODO: TextInputFocusEventData doesn't contain relatedTarget.
const relatedTargetId = event.nativeEvent?.relatedTarget?.id;
if (relatedTargetId && [messageEditInput, emojiButtonID].includes(relatedTargetId)) {
return;
}
setShouldShowComposeInputKeyboardAware(true);
}}

The way it works is, that if the pressed element is an emoji picker button ID, then don't show the main composer yet. However, the emoji picker button element doesn't have the ID set.

We already pass the ID here,

However, the pressable component accepts nativeID prop instead of id.


What changes do you think we should make in order to solve the problem?

Rename the props from id to nativeID specifically in EmojiPickerButton (or we can rename the pressable props to id, but we need to rename it for many components too).

we may need to check for messageEditInput ID too

Note: in native, the main composer will still appear (even though covered by the modal) because it's blurred when the modal shows. To further improve it, we can ignore the blur when the emoji picker modal is active.

if (relatedTargetId && [messageEditInput, emojiButtonID].includes(relatedTargetId) || EmojiPickerAction.isActive(action.reportActionID)) {
    return;
}

But there are currently 2 issues with EmojiPickerAction.isActive. EmojiPickerAction.isActive compares the active ID and the passed ID.

const isActive = (id: string) => !!id && id === activeID;

The active ID is set after calculating the anchor position, but we need to set it immediately when calling showEmojiPicker.

calculateAnchorPosition(emojiPopoverAnchor?.current, anchorOriginValue).then((value) => {
onWillShow?.();
setIsEmojiPickerVisible(true);
setEmojiPopoverAnchorPosition({
horizontal: value.horizontal,
vertical: value.vertical,
});
emojiAnchorDimension.current = {
width: value.width,
height: value.height,
};
setEmojiPopoverAnchorOrigin(anchorOriginValue);
setActiveID(id);

Second, we never clear the active ID when closing the emoji picker, so we need to do that.

@melvin-bot melvin-bot bot added the Overdue label Apr 22, 2024
@puneetlath puneetlath added the External Added to denote the issue can be worked on by a contributor label Apr 22, 2024
@melvin-bot melvin-bot bot changed the title mWeb - Chat - Before emoji picker box opens, a seperate compose box with cursor is shown briefly [$250] mWeb - Chat - Before emoji picker box opens, a seperate compose box with cursor is shown briefly Apr 22, 2024
Copy link

melvin-bot bot commented Apr 22, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01030e7a0cab136f03

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 22, 2024
Copy link

melvin-bot bot commented Apr 22, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @s77rt (External)

@melvin-bot melvin-bot bot removed the Overdue label Apr 22, 2024
@puneetlath
Copy link
Contributor

@s77rt FYI there is already a proposal above.

@s77rt
Copy link
Contributor

s77rt commented Apr 23, 2024

@bernhardoj Thanks for the proposal. Your RCA is correct. This looks to be a regression from 822efb5. Regarding the web solution, we should use id since nativeID is deprecated. Regarding native, did you try clearing the active action? I remember we had some tricky bugs on that area and a lengthy issue #23908

@bernhardoj
Copy link
Contributor

Yes, I tried it. The isActive issue of emoji picker is also mentioned in the proposal there
image

but instead of clearing it when other edit message is focused, we should clear it when the emoji picker hides.

btw, the 3rd case in the linked issue happens on main

@s77rt
Copy link
Contributor

s77rt commented Apr 24, 2024

@bernhardoj

but instead of clearing it when other edit message is focused, we should clear it when the emoji picker hides

That was the first attempt but didn't work well when a message is deleted from another device while the emoji picker for that message is still open. Let's test that scenario as well as other cases where EmojiPickerAction.isActive is used.

🎀 👀 🎀 C+ reviewed
Link to proposal

@melvin-bot melvin-bot bot added the Overdue label Apr 26, 2024
@s77rt
Copy link
Contributor

s77rt commented Apr 29, 2024

Not overdue. @puneetlath ^

@melvin-bot melvin-bot bot removed the Overdue label Apr 29, 2024
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 29, 2024
Copy link

melvin-bot bot commented Apr 29, 2024

📣 @s77rt 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Apr 29, 2024

📣 @bernhardoj 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Apr 30, 2024
@bernhardoj
Copy link
Contributor

PR is ready

cc: @s77rt

@melvin-bot melvin-bot bot removed the Weekly KSv2 label May 23, 2024
Copy link

melvin-bot bot commented May 23, 2024

This issue has not been updated in over 15 days. @puneetlath, @s77rt, @bernhardoj eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@melvin-bot melvin-bot bot added the Monthly KSv2 label May 23, 2024
@s77rt
Copy link
Contributor

s77rt commented May 23, 2024

PR was deployed to production 2 weeks ago

@puneetlath
Copy link
Contributor

Whoops, right you are. Can you complete the checklist @s77rt?

@puneetlath
Copy link
Contributor

@bernhardoj has been paid.

@s77rt payment just pending checklist above.

@s77rt
Copy link
Contributor

s77rt commented May 27, 2024

  • The PR that introduced the bug has been identified: Upgrade to react-native-web v0.19.9 #24482
  • The offending PR has been commented on: 822efb5#r142442593
  • A discussion in #expensify-bugs has been started: I don't feel we have much to discuss, the bug was caused by conflicts
  • Determine if we should create a regression test for this bug: No

@s77rt
Copy link
Contributor

s77rt commented May 27, 2024

@puneetlath Done!

@puneetlath
Copy link
Contributor

kk all paid. Thanks everyone and sorry for the delay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Monthly KSv2 Reviewing Has a PR in review
Projects
Archived in project
Development

No branches or pull requests

4 participants