-
Notifications
You must be signed in to change notification settings - Fork 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
[HOLD for payment 2023-05-05] [$1000] Long pressing on emoji suggestions highlights the text/attachments behind the emoji list on mweb #16485
Comments
Triggered auto assignment to @garrettmknight ( |
Bug0 Triage Checklist (Main S/O)
|
@garrettmknight Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
Confirmed, agree that we should make this consistent and the expected result makes sense. |
Job added to Upwork: https://www.upwork.com/jobs/~0170cd69222271989f |
Current assignee @garrettmknight is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rushatgabhane ( |
Triggered auto assignment to @Beamanator ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.On mobile web, long pressing on an emoji suggestion results in the report action context menu being opened after the emoji suggestion component is dismissed. What is the root cause of that problem?The root cause seems to be the order of the event loop. The press is being intercepted by the view below the emoji suggestions as soon as focus is lost as a result of the long press. First focus is lost, and then the press handler is firing. It does not happen with normal presses because there is no responder for that event on the underlying view, and it's also being intercepted using onMouseDown={() => e.preventDefault()} which does not emit for a long press. What changes do you think we should make in order to solve the problem?The easiest way I found to solve this problem is to simply defer the function call that hides the emoji suggestions until after the event loop completes. This can be very easily achieved by replacing:
with setTimeout(() => this.resetSelectedEmojis(), 0) What alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.Chat context menu shows when we long press an emoji suggestion. What is the root cause of that problem?When we long press the emoji suggestion, the suggestion list will be dismissed because the composer is blurred. App/src/pages/home/report/ReportActionCompose.js Lines 831 to 834 in 3a9ce6f
The blur is the normal behavior on web. We can verify this by long press any element, for example the send button. When we long press an element, we can catch the event by listen to
So, how the event is triggered even though we long press the emoji suggestion? I don't have a reference to why it happens, but we can reproduce it with a simple html. Here is the codepen https://codepen.io/bernhardoj/pen/XWPwBJO to try it. (video): WhatsApp.Video.2023-03-31.at.09.51.53.mp4I change the console log to alert to debug it easier. The codepen is trying to replicate our chat page. The red box is the emoji suggestion which will hide when the input is blurred. Execute the same steps and notice an alert with text The purpose of App/src/components/PressableWithSecondaryInteraction/index.js Lines 28 to 31 in 3a9ce6f
On native/mWeb, we already have a long press event. App/src/components/PressableWithSecondaryInteraction/index.js Lines 59 to 67 in 3a9ce6f
What changes do you think we should make in order to solve the problem?We can listen the
Or is it better to use |
@bernhardoj it would be great if you can share the html on codepen :) |
Anyway, both solutions feel like a hack to me because we don't know the exact root cause |
Added the codepen and video.
This is the root cause which you can validate with the codepen I provided. |
After digging into this a bit more, I have found that none of the other emoji components, or the context menu items, respond to a long press on mWeb. I think if we want to keep things consistent we should match the behavior of the other components and prevent a long press from actually closing the emoji suggestion dialog. Long pressing on an emoji suggestion does not actually add the emoji, but just keeps the text you entered up to the point that it opened, so it does not make sense to close the menu when it happens. I have updated my proposal to reflect this solution. |
is there some documentation for this? is this bug logged for chrome? if yes, then won't it fix itself after some chrome updates?
@bernhardoj @redstar504 I think that is a hack. |
Here is my opinion on why disabling the First of all, the current issue we are facing is currently the behavior of browsers (except for Safari mobile, I will explain more on this later) as I explained here #16485 (comment). Here is a sandbox https://codesandbox.io/s/context-menu-oyj370 to test that behavior on non-mobile web. Right click the red box and you will see the Now, why it does not happen on iOS Safari? That is because iOS Safari never fires If you read the 3rd source (the twitter one), they said
which we already does with the App/src/components/PressableWithSecondaryInteraction/index.js Lines 59 to 67 in 4ee21e9
That's why disabling the |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Still working on this one @rushatgabhane can you review the updated proposal and if you still think it's a hack we'll double and find another proposal? |
Hi, I‘ve pushed a commit to prevent the focus event. And now have a small question, which of the following is our expected behavior? 1. the emoji will not be placed in the main input until the touch is released.
release.mp42. support long press (
|
<Pressable | |
style={({hovered}) => StyleUtils.getEmojiSuggestionItemStyle( | |
props.highlightedEmojiIndex, | |
CONST.EMOJI_SUGGESTER.ITEM_HEIGHT, | |
hovered, | |
index, | |
)} | |
onMouseDown={e => e.preventDefault()} | |
onPress={() => props.onSelect(index)} |
Or we still keep option 1 for native app and use option 3 for mWeb platform uniformly? (This way we don't need to add onLongPress
prop)
What do you think is the best UX? Then, if we all agree on that, let's make it consistent on all platforms. I actually don't have a good idea of what I would expect to happen here. I very rarely use longpress for anything, so I would probably expect nothing to happen (which I think is option 3). |
keep it simple. do nothing on long press |
My initial thought was that we just need to make sure there is no wrong interaction on long press( the context menu appears unexpectedly). As for whether or not emoji are selected on a long press is probably not a big deal, we can just leave as it is, after all, the main way to select an emoji is by tapping it. |
Fine, I will add |
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results. If a regression has occurred and you are the assigned CM follow the instructions here. If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future. |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.7-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2023-05-05. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
Checklist to please the bot :)
|
@tgolen, @ntdiary, @michaelhaxhiu, @rushatgabhane Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
edit: A speed bonus should apply for the C and C+. cc @ntdiary and @rushatgabhane |
@michaelhaxhiu looks like there is a timeline bonus as per https://ex-syt.glitch.me/ |
Ahh the ol "3 business days" caught me up! Thanks for that :) |
Ok so, these are the payouts:
|
Just waiting on @rushatgabhane to accept the job and I can pay/close. |
Paid all parties |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
There should be consistency between the mweb and android/web where long pressing the emoji from the suggestion list should place the emoji on the chat box on mweb
Actual Result:
Long pressing the emoji in the emoji suggestion list selects the text/attachment (any text) behind the suggestion list on mweb chrome
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.2.88-0
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:
emojierror.mp4
az_recorder_20230324_133659.1.mp4
Expensify/Expensify Issue URL:
Issue reported by: @priya-zha
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1679662560223179
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: