-
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 2024-01-24] [$500] Web - Workspace - The initial selection applies to the new name too #33652
Comments
Job added to Upwork: https://www.upwork.com/jobs/~01e5da23ce75593d7a |
Triggered auto assignment to @JmillsExpensify ( |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to Contributor-plus team member for initial proposal review - @getusha ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.When replacing the text in the room name, the selection remains. What is the root cause of that problem?This is happening because of the following code: App/src/components/RoomNameInput/index.js Lines 35 to 42 in 054eb86
It was intended to prevent the cursor from jumping to the end while adding a space (that should be replaced with What changes do you think we should make in order to solve the problem?There is no need to move the start of the selection along with the end of it. We should discard the selection and move the cursor to the end of the replaced text (as seen in the recording below): if (modifiedRoomName !== newRoomNameWithHash) {
const offset = modifiedRoomName.length - oldRoomNameWithHash.length;
const newSelection = {
- start: selection.start + offset,
+ start: selection.end + offset,
end: selection.end + offset,
};
setSelection(newSelection);
} Result:Screen.Recording.2023-12-27.at.19.35.28.movWhat alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.When replacing the text in the room name, the selection remains. What is the root cause of that problem?This is happening because of the following code: App/src/components/RoomNameInput/index.js Lines 35 to 42 in 054eb86
What changes do you think we should make in order to solve the problem?We need this logic and add new. if (modifiedRoomName !== newRoomNameWithHash) {
const newSelection = {
start: modifiedRoomName.length,
end: modifiedRoomName.length,
};
setSelection(newSelection);
} What alternative solutions did you explore? (Optional) |
@paultsimura your RCA makes sense, but i am not sure why this is happening on texts with space between words. i am trying to test the solution. |
This is because, in the room names, the spaces (and iOS-specific dashes) get replaced with dashes: App/src/libs/RoomNameInputUtils.ts Lines 6 to 14 in 5c5c862
And because of this, only for the names with spaces, this condition becomes App/src/components/RoomNameInput/index.js Lines 35 to 42 in 5c5c862
|
@JmillsExpensify, @getusha Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Testing proposals. |
@getusha does this explanation make sense to you though? #33652 (comment) |
|
We must compare the string values here. If we enter "some text", it will be transformed into "some-text", so the length will be the same and the logic will not be executed. As a result, the cursor will jump to the end of the input every time a space is added, and this logic was added to fix exactly this: Screen.Recording.2024-01-01.at.15.06.35.movThe whole logic is correct, we just need to handle the selection start as I've described in the proposal. |
Discussing proposals |
The proposal from @paultsimura looks good to me and works well, thanks for the patience! |
Triggered auto assignment to @marcaaron, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
Proposal looks ok. The bug feels very minor to me. I am surprised we have such complex logic for pasting text into an input. |
Thanks. The PR is ready for review: #34076 |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.25-10 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 2024-01-24. 🎊 For reference, here are some details about the assignees on this 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:
|
@getusha Mind helping get us kicked off with the BZ checklist? |
Payment summary:
|
Offers sent to both contributors! |
Thanks, accepted |
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: [@getusha] The PR that introduced the bug has been identified. Link to the PR: https://github.com/Expensify/App/pull/ [@getusha] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: https://github.com/Expensify/App/pull/12899/files#r1467873981 [@getusha] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: N/a [@getusha] Determine if we should create a regression test for this bug. No, this is a very minor bug [@getusha] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again. |
Thanks @getusha. Those make sense to me. I've processed your offer in Upwork so I'll close this issue. |
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.17.1
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: Applause - Internal Team
Slack conversation:
Action Performed:
Expected Result:
The previous selection shouldn't be applied to the pasted text.
Actual Result:
The initial selection applies to the new name too.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6326857_1703692738965.bandicam_2023-12-26_16-01-44-803.mp4
View all open jobs on GitHub
The text was updated successfully, but these errors were encountered: