-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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-04-25] [$500] [LOW] Request money - When amount is highlighted, clicking on the page does not deselect the text #36862
Comments
Triggered auto assignment to @laurenreidexpensify ( |
I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors. We think that this bug might be related to #vip-bills |
ProposalPlease re-state the problem that we are trying to solve in this issue.Request money - When amount is highlighted, clicking on the page does not deselect the text What is the root cause of that problem?We call App/src/pages/iou/steps/MoneyRequestAmountForm.js Lines 107 to 112 in c261148
What changes do you think we should make in order to solve the problem?Initial ProposalWe should use `removeAllRanges` after calling `event.preventDefault();` in `onMouseDown`.This can be done using code below: if (window.getSelection) {
window.getSelection().removeAllRanges();
} else if (document.selection) {
document.selection.empty();
} PS: We shouldn't use
Resulttext_selection_amount_form.mp4AlternativeRemove OptionalThe text selection is also not removed when we move to currency selection page and go back. For that we can use useEffect(() => {
if (!isFocused) {
return;
}
setSelection({
start: currentAmount.length,
end: currentAmount.length,
});
}, [isFocused, setSelection]); Bug Video:bug_selection_2.mp4Alternative 2We can set selection start and end to setSelection({
start: selection.end,
end: selection.end,
}); If we also want to fix the bug I mentioned in the optional section, we can do that like: useEffect(() => {
if (!isFocused || wasFocused) {
return;
}
setSelection({
start: selection.end,
end: selection.end,
});
}, [selection.end, isFocused, selection, wasFocused]); If we want the same behaviour on native devices also we need to wrap Demo Code <PressableWithoutFeedback
onMouseDown={(event) => {
onMouseDown(event, [AMOUNT_VIEW_ID]);
}}
style={[styles.moneyRequestAmountContainer, styles.flex1, styles.w100, styles.cursorDefault]}
accessibilityLabel="asda"
role={CONST.ROLE.NONE}
onPress={(event) => {
event?.stopPropagation();
event?.preventDefault();
if (selection.end === selection.start || !textInput.current?.isFocused()) {
return;
}
setSelection({
start: selection.end,
end: selection.end,
});
if (!textInput.current) {
return;
}
if (!textInput.current.isFocused()) {
textInput.current.focus();
}
}}
>
<View
id={AMOUNT_VIEW_ID}
// style={[styles.w100, styles.justifyContentEnd, styles.pageWrapper, styles.pt0]}
style={[styles.moneyRequestAmountContainer, styles.flex1, styles.flexRow, styles.w100, styles.alignItemsCenter, styles.justifyContentCenter]}
>
<TextInputWithCurrencySymbol
formattedAmount={formattedAmount}
onChangeAmount={setNewAmount}
onCurrencyButtonPress={onCurrencyButtonPress}
placeholder={numberFormat(0)}
ref={(ref) => {
if (typeof forwardedRef === 'function') {
forwardedRef(ref);
} else if (forwardedRef?.current) {
// eslint-disable-next-line no-param-reassign
forwardedRef.current = ref;
}
textInput.current = ref;
}}
selectedCurrencyCode={currency}
selection={selection}
onSelectionChange={(e: NativeSyntheticEvent<TextInputSelectionChangeEventData>) => {
if (!shouldUpdateSelection) {
return;
}
const maxSelection = formattedAmount.length;
const start = Math.min(e.nativeEvent.selection.start, maxSelection);
const end = Math.min(e.nativeEvent.selection.end, maxSelection);
setSelection({start, end});
}}
onKeyPress={textInputKeyPress}
isCurrencyPressable
/>
{!!formError && (
<FormHelpMessage
style={[styles.pAbsolute, styles.b0, styles.mb0, styles.ph5, styles.w100]}
isError
message={formError}
/>
)}
</View>
</PressableWithoutFeedback> Resultfix_amount_selection.mp4 |
Adding to the vip bill pay project board as a |
Job added to Upwork: https://www.upwork.com/jobs/~01626cde7ff61398d1 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.The text is not deselected, and remains highlighted. What is the root cause of that problem?The amount input takes up all remaining height. when we click on this space App/src/pages/iou/steps/MoneyRequestAmountForm.js Lines 108 to 114 in c261148
What changes do you think we should make in order to solve the problem?We can update the selection state when we click on the space of the input wrapper afte we call prevent default
App/src/pages/iou/steps/MoneyRequestAmountForm.js Lines 108 to 114 in c261148
What alternative solutions did you explore? (Optional)NA |
Proposal Updated
|
Planning to go OOO! Please reassign @laurenreidexpensify. |
I can take over. I am not able to select text on main so stuck on Step 3. Looks like another regression Screen.Recording.2024-02-21.at.10.41.51.PM.mov |
Regressions from #35774 cc: @ishpaul777 @neonbhai |
@neonbhai tag me when you have fix ready for review, ideally before this hit staging |
@situchan assigned 👍 |
PR fixing selection issue has been merged 🚀 |
ok so we can continue this issue |
This was deploy blocker. |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.62-17 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-04-25. 🎊 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:
|
No need for this |
@Krishna2323 pls accept offer in Upwork thanks! @situchan still offline this month |
@laurenreidexpensify, offer accepted :) |
Payment Summary
BugZero Checklist (@laurenreidexpensify)
|
Payment Summary: Contributor: $500 @Krishna2323 paid in upwork steps to complete when @situchan is back from OOO in May:
|
@laurenreidexpensify Sorry for late. Can you please send new offer? |
@situchan offer sent in upwork 👍 |
Payment Summary: Contributor: $500 @Krishna2323 paid in upwork |
@situchan can you confirm regression testing steps so we can close out thanks |
Regression Test Proposal
|
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Found when validating PR : #36463
Version Number: v1.4.43-0
Reproducible in staging?: Y
Reproducible in production?: N
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause-Internal Team
Slack conversation:
Action Performed:
Pre-requisite: the user should be logged in.
Expected Result:
The text should be deselected after clicking on the page.
Actual Result:
The text is not deselected, remains highlighted.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Bug6385343_1708407498195.bandicam_2024-02-19_23-02-52-094.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @laurenreidexpensifyThe text was updated successfully, but these errors were encountered: