-
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-07-26] [$1000] Cursor jumps to previous word while correcting incorrect emoji #17275
Comments
Triggered auto assignment to @NicMendonca ( |
Bug0 Triage Checklist (Main S/O)
|
👍 tested on slack and the cursor jumps to the end of the emoji |
Job added to Upwork: https://www.upwork.com/jobs/~01a71f9bea3c846625 |
Current assignee @NicMendonca is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat ( |
Triggered auto assignment to @tylerkaraszewski ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Cursor jumps to previous word while correcting incorrect emoji What is the root cause of that problem?The issue is caused here App/src/pages/home/report/ReportActionCompose/index.js Lines 577 to 583 in 8fd518c
Basically this logic is doing this: find the common ending of old and new comment to find where change is happened, and define new selection values to put cursor on the right place.
What changes do you think we should make in order to solve the problem?To solve this issue we should improve this logic to get common ending substring of old and new comments. I made a function which checks two strings and returns common ending. Using this function we put cursor right after change in comment(right after emoji inserted). Iether we can change above logic to call my function every time. Or we can apply so that my function is called only in this situation where remainder( I can explain more in details if any questions occur cursor.jump.emoji.issue.movWhat alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.Cursor start jumps to previous word while correcting incorrect emoji What is the root cause of that problem?incorrect calculation for selection after text lenght change (it work fine in other cases but not covered this case). App/src/pages/home/report/ReportActionCompose/index.js Lines 577 to 583 in de0ec68
it works fine in this case for example if cursor symbolizes as ^ but in issue case: this way not work fine, for example: What changes do you think we should make in order to solve the problem?change calculate selection start way to cover the issue case, see explanation after code. if (comment !== newComment) {
let matchEmoji;
// eslint-disable-next-line no-cond-assign
while ((matchEmoji = CONST.REGEX.EMOJI_NAME.exec(comment)) !== null) {
const checkEmoji = emojisTrie.search(matchEmoji[0].slice(1, -1));
if (checkEmoji && checkEmoji.metaData.code) {
newState.selection = {
start: matchEmoji.index + 1,
end: matchEmoji.index + 1,
};
break;
}
}
} new selection start should be after emoji which mean prev comment value get index of imoji text + 1
What alternative solutions did you explore? (Optional)Same as solution above, but use match instead exec. if (comment !== newComment) {
const emojiData = comment.match(CONST.REGEX.EMOJI_NAME);
if (_.isArray(emojiData) && emojiData.length > 0) {
for (let i = 0; i < emojiData.length; i++) {
const name = emojiData[i].slice(1, -1); // remove start and end ":"
const checkEmoji = emojisTrie.search(name);
if (checkEmoji && checkEmoji.metaData.code) {
newState.selection = {
start: comment.indexOf(emojiData[i]) + 1,
end: comment.indexOf(emojiData[i]) + 1,
};
}
}
}
} We should use loop to skip match :non-emoji-value: if (checkEmoji && checkEmoji.metaData.code) {
const index = comment.indexOf(emojiData[i]);
if (prevState.selection.end >= index && prevState.selection.end <= (index + emojiData[i].length)){
newState.selection = {
start: index + 1,
end: index + 1,
};
}
} |
Updated broken video - #17275 (comment) |
@alitoshmatov Do you mind explaining the logic of that function in your proposal? |
@parasharrajat Yes, basically it is a utility function which takes two string inputs and returns common ending substring
|
@ahmedGaber93 #17275 (comment) your solution is not working. When new emoji is inserted, It is confusing and putting cursor to a string with columns in two side which is not emoji |
@alitoshmatov thanks for your comment, please tell me what you try to type and what's the result displayed for you? |
@ahmedGaber93 cursor - ^ I am not sure right now where the cursor jumped, but it was definitely around |
@alitoshmatov thanks fot testing my proposal. if (comment !== newComment) {
let matchEmoji;
// eslint-disable-next-line no-cond-assign
while ((matchEmoji = CONST.REGEX.EMOJI_NAME.exec(comment)) !== null) {
const checkEmoji = emojisTrie.search(matchEmoji[0].slice(1, -1));
if (checkEmoji && checkEmoji.metaData.code) {
newState.selection = {
start: matchEmoji.index + 1,
end: matchEmoji.index + 1,
};
break;
}
}
} try it now. |
Dupe of this #13066 |
@parasharrajat do you think this is a proper dupe? ☝️ |
Checking... |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Triggered auto assignment to @MariaHCD, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
Nice! @alitoshmatov's proposal looks good to me too. |
📣 @aimane-chnaif 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
📣 @alitoshmatov 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Upwork job |
📣 @hungvu193 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app! |
PR is ready - #22827 |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.42-26 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-07-26. 🎊 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:
|
@hungvu193 - reporting: $250 |
^ all 3 of have been paid 🎉 |
@aimane-chnaif just a reminder on the BZ checklist: #17275 (comment) |
Regression Test Proposal:
|
Thank you! All set here! Payment summary here: #17275 (comment) |
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
Cursor should stay after the emoji.
Actual Result
Cursor jump to previous word.
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.2.98-2
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
Recording.200.mp4
Screen.Recording.2023-04-11.at.09.40.54.mov
Expensify/Expensify Issue URL:
Issue reported by: @hungvu193
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1681181274203469
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: