Repository navigation
Description
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.3.85-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
Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1697546821680559
Action Performed:
- Open the app
- Open any report
- Copy text from any source which has emoji text in middle and not in end eg: Hello How are you :joy test (colon after joy)
- Paste in composer and observe that cursor is stuck after emoji instead of displaying it in the end
Expected Result:
App should display cursor at the end of text when we paste any text
Actual Result:
App displays cursor after emoji even when we paste text with emoji text in middle and not in end
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
Android: Native
Android.native.emoji.cursor.position.issue.mp4
Android: mWeb Chrome
Android.chrome.wrong.cursor.position.issue.emoji.mp4
iOS: Native
ios.native.cursor.postion.issue.emoji.mov
iOS: mWeb Safari
ios.safari.cursor.postion.issue.emoji.mov
MacOS: Chrome / Safari
Recording.109.mp4
windows.chrome.cursor.postion.emoji.issue.mp4
MacOS: Desktop
mac.desktop.cursor.position.wrong.emoji.mov
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~01d23deb324334bf75
- Upwork Job ID: 1714318176195219456
- Last Price Increase: 2023-11-07
- Automatic offers:
- Ollyws | Reviewer | 27651044
- barros001 | Contributor | 27651045
- dhanashree-sawant | Reporter | 27651046
Activity
melvin-bot commentedon Oct 17, 2023
Triggered auto assignment to @CortneyOfstad (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.[-]Cursor position is stuck after emoji on copy pasting text with emoji text in it[/-][+][$500] Cursor position is stuck after emoji on copy pasting text with emoji text in it[/+]melvin-bot commentedon Oct 17, 2023
Job added to Upwork: https://www.upwork.com/jobs/~01d23deb324334bf75
melvin-bot commentedon Oct 17, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Oct 17, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Ollyws (
External)ZhenjaHorbach commentedon Oct 17, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Cursor position is stuck after emoji on copy pasting text with emoji text in it
What is the root cause of that problem?
Our text input works like this:
What when we convert text to emoji
the cursor always appears behind the emoji
What changes do you think we should make in order to solve the problem?
react/react-native#22794
Since, unfortunately, we do not have native support
Since the proposition was rejected
We have no way to track when we insert text
We can try to do it differently
And add a comparison of the text that is sent to the input and that is stored in the clipboard
We can update this code
App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions.js
Lines 226 to 237 in c498ab5
Like
As an alternative Clipboard.getString we can use useClipboard
https://github.com/react-native-clipboard/clipboard#useclipboard
What alternative solutions did you explore? (Optional)
Also, we can try to use
onChangehttps://reactnative.dev/docs/textinput#onchange
with which we can get information about the entered text
In native event we have a data field
which matches the last characters entered
And if the
datacontains more than one characterThis means that this text was pasted
Because if we just write text
The data will be one symbol long
And if we have more than one character we will use the same logic as in original proposition
As a result we can update this line like
Optional
We can take some of the logic from the original proposition and add
App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions.js
Line 535 in c498ab5
This like
(commentValue, shouldDebounceSaveComment, isPasted) => {App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions.js
Line 212 in c498ab5
And setSelection like
App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions.js
Lines 233 to 236 in c498ab5
tienifr commentedon Oct 18, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Cursor position is stuck after emoji on copy pasting text with emoji text in it
What is the root cause of that problem?
When users paste the text to composer, we're running the following code
App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions.js
Lines 231 to 236 in 9d79fd1
we set
start: newComment.length - remainderis not correct, let's take a look at the above examplecommentValue =
Hello How are you :joy:testnewComment =
Hello How are you 😂 test-> remainder = 5
-> the selection always is after emoji
What changes do you think we should make in order to solve the problem?
We should not use the remainder here. When users change the input value, we should calculate the actual length change and use this value to update selection
Result
Screen.Recording.2023-10-18.at.16.14.59.mov
CortneyOfstad commentedon Oct 18, 2023
@Ollyws any thoughts on the proposals above? TIA!
CortneyOfstad commentedon Oct 18, 2023
I am heading OoO until Oct. 25 so reassigning BZ to keep an eye on this while I am gone 👍
57 remaining items
barros001 commentedon Nov 13, 2023
PR up for review.
[-][$500] Cursor position is stuck after emoji on copy pasting text with emoji text in it[/-][+][HOLD for payment 2023-11-30] [$500] Cursor position is stuck after emoji on copy pasting text with emoji text in it[/+]melvin-bot commentedon Nov 23, 2023
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Nov 23, 2023
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.2-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-11-30. 🎊
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.
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Nov 23, 2023
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:
Ollyws commentedon Nov 30, 2023
BugZero Checklist:
I don't think we can say this is a regression from any PR, It was just only considered that when converting an emoji the cursor should be placed after the emoji regardles if it was typed or pasted.
N/A
N/A
I don't think a regression test is necessary as we added numerous unit tests that should catch any unwanted changes to the intended behaviour.
CortneyOfstad commentedon Dec 1, 2023
@dhanashree-sawant, @Ollyws @barros001 — all have been paid via Upwork and no regression test required, so closing! Thanks all!