-
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-10-09] [$500] Web - Pasting emojis freezes cursor position in composer box (works fine in edit message) #27672
Comments
ProposalPlease re-state the problem that we are trying to solve in this issue.Pasting emojis freezes cursor position in composer box (works fine in edit message) What is the root cause of that problem?wrong calculation by getCommonSuffixLength here
App/src/libs/ComposerUtils/index.js Lines 37 to 43 in c77814f
how getCommonSuffixLength work? see this example const reminder = getCommonSuffixLength("START :joy END", "START 😂 END"); // CommonSuffix is ` END` and length 4.
const newSelection = "START 😂 END".length - reminder; // result 12 - 4 = 8
// cursor position 8 is true and set after the emoji Why it failed in this case. // note "😂 ".length is 3
const reminder = getCommonSuffixLength("😂 ", "😂 😂 "); // resul 3
const newSelection = "😂 😂 ".length - reminder; // result 6 - 3 = 3
const reminder = getCommonSuffixLength("😂 😂 ", "😂 😂 😂 "); // resul 6
const newSelection = "😂 😂 😂 ".length - reminder; // result 9 - 6 = 3
const reminder = getCommonSuffixLength("😂 😂 😂 ", "😂 😂 😂 😂 "); // resul 9
const newSelection = "😂 😂 😂 😂 ".length - reminder; // result 12 - 9 = 3
whatever we type the newSelection is 3.
// CommonSuffix between `😂 😂 cursor here 😂` and `😂 😂 😂 😂 ` should be only `😂 `
// but becaue the replace emoji match the previous of it, CommonSuffix wii be 😂 😂 😂 What changes do you think we should make in order to solve the problem?Reverse the way we used to get the new position. What is the different in the new way?when we use CommonPrefix we will stop in the current cursor position, so if the replaced emoji match the next of it, it not affect because we will stop in the current cursor position // add this new method on ComposerUtils
function getCommonPrefixLength(str1, str2, end) {
let i = 0;
while (str1[i] === str2[i] && i < end) { // start from i not length - 1 - i and i < end will do the disired fix.
i++;
}
return i;
} and the emoji length and newSelectionPosition length if (commentValue !== newComment) {
const remainder = ComposerUtils.getCommonPrefixLength(commentRef.current, newComment, selection.end);
const emojiLength = newComment.substring(remainder).match(CONST.REGEX.EMOJIS)[0].length;
const spaceAfterEmojiLength = 1;
const newSelectionPosition = remainder + emojiLength + spaceAfterEmojiLength;
setSelection({
start: newSelectionPosition,
end: newSelectionPosition,
});
} we need to add selection.end in callback deps result Screen.Recording.2023-09-18.at.1.34.22.AM.movWhat alternative solutions did you explore? (Optional)N/A |
Triggered auto assignment to @lschurr ( |
Job added to Upwork: https://www.upwork.com/jobs/~0141004fff370e0c4e |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to @Christinadobrzyn ( |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Ollyws ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
const commentValue = ":joy:";
const newComment = " 😂 "; // After parsing
const isEqual = commentValue === newComment; // false What changes do you think we should make in order to solve the problem?
What alternative solutions did you explore? (Optional)
|
This is reproducible and I can't find another GH related so I think we can move forward with reviewing these proposals. |
Hi @Ollyws would you be able to take a peek at the proposals to see if they will work? |
Will review asap. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Couldn't get to this one today will review it tomorrow. |
It seems when When So I like @jeet-dhandha's proposal as we're simply changing the 🎀👀🎀 C+ reviewed |
Triggered auto assignment to @hayata-suenaga, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
📣 @Ollyws 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
📣 @jeet-dhandha 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
📣 @dhanashree-sawant 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app! |
@Ollyws - PR Ready for Review. |
🎯 ⚡️ Woah @Ollyws / @jeet-dhandha, great job pushing this forwards! ⚡️ The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉
On to the next one 🚀 |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.75-12 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-10-09. 🎊 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:
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:
|
BugZero Checklist: The PR that introduced the bug has been identified. Link to the PR: #18648 The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn I don't think a regression test would be helpful here as it's not related to an important user flow nor is it very impactful. |
Bump for Payment. |
Payouts due: Issue Reporter: $50 @dhanashree-sawant (paid in Upwork) Eligible for 50% #urgency bonus? Y - based on #27672 (comment) Upwork job is here (it's now closed so let me know if you need something) Closing as complete! |
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:
App should move cursor to end on pasting the emojis in compose box as it does in edit message box
Actual Result:
App freezes cursor after first pasted emoji in compose box
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.71.4
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: Any additional supporting documentation
pasting.emoji.in.composer.freezes.the.cursor.position.mp4
Recording.4556.mp4
Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1694883795401949
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: