-
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 2022-11-29] [$1000] BUG: The text inside the composer input and the menu on the settings page got highlighted when triple-click on the last report chat reported by @mollfpr #12028
Comments
Triggered auto assignment to @trjExpensify ( |
Current assignee @trjExpensify is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia ( |
Triggered auto assignment to @chiragsalian ( |
I can reproduce this reliably on |
Job on Upwork here: https://www.upwork.com/jobs/~019c6881ba683194f2 |
Proposal Solution - <ScreenWrapper >
+ <ScreenWrapper style={[styles.settingsPageWrapper]}>
<HeaderWithCloseButton
title={this.props.translate('common.settings')}
onCloseButtonPress={() => Navigation.dismissModal(true)}
/> +settingsPageWrapper: {
+ MozUserSelect: "none",
+ WebkitUserSelect: "none",
+ MsUserSelect: "none",
+} We also need to update this style to other screen in this page too (Workspace, profile, Preference....) Screen.Recording.2022-10-22.at.19.09.39.mov |
Looks like something related to As a reminder, please make sure that all proposals are not workarounds and that any and all attempt to fix the issue holistically have been made before proceeding with a solution. Proposals to change our Feel free to drop a note in #expensify-open-source with any questions. |
@chiragsalian, @trjExpensify, @thesahindia Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
@chiragsalian, @trjExpensify, @thesahindia Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
@hungvu193, the text inside the composer still gets selected. I think your solution is a workaround. We need to find the root cause. |
ProposalRoot causeI think it's related to how chrome behaves with a triple click. They have a related bug with status won't fix WorkaroundMy proposed solution is also a workaround, but let me know if it's acceptable. The idea is to override the selection with the desired contents. We can wrap git diff src/pages/home/report/ReportActionItemMessage.js
diff --git a/src/pages/home/report/ReportActionItemMessage.js b/src/pages/home/report/ReportActionItemMessage.js
index d226ac9ced..af88ac4e5e 100644
--- a/src/pages/home/report/ReportActionItemMessage.js
+++ b/src/pages/home/report/ReportActionItemMessage.js
@@ -26,18 +26,33 @@ const defaultProps = {
style: [],
};
+const selectElementContents = (el) => {
+ const sel = window.getSelection();
+ sel.removeAllRanges();
+ const range = document.createRange();
+ range.selectNodeContents(el);
+ sel.addRange(range);
+};
+
+const onClick = (e) => {
+ if (e.detail !== 3) { return; }
+ selectElementContents(e.target);
+};
+
const ReportActionItemMessage = props => (
<View style={[styles.chatItemMessage, ...props.style]}>
{_.map(_.compact(props.action.previousMessage || props.action.message), (fragment, index) => (
- <ReportActionItemFragment
- key={`actionFragment-${props.action.sequenceNumber}-${index}`}
- fragment={fragment}
- isAttachment={props.action.isAttachment}
- attachmentInfo={props.action.attachmentInfo}
- source={lodashGet(props.action, 'originalMessage.source')}
- loading={props.action.isLoading}
- style={props.style}
- />
+ <div role="presentation" onClick={onClick}>
+ <ReportActionItemFragment
+ key={`actionFragment-${props.action.sequenceNumber}-${index}`}
+ fragment={fragment}
+ isAttachment={props.action.isAttachment}
+ attachmentInfo={props.action.attachmentInfo}
+ source={lodashGet(props.action, 'originalMessage.source')}
+ loading={props.action.isLoading}
+ style={props.style}
+ />
+ </div>
))}
</View>
); I know this solution will still have the wrong selection at first, but it will immediately correct the text selection. Please have a look at the video. Recording.42.mp4 |
@wildan-m, the issue can be seen on other browsers as well. Waiting for more proposals. |
Proposal (Updated)@thesahindia, you are right, I can also reproduce it in Safari. I still believe that it's caused by the different triple-click behavior of browsers I've resolved glitches in my previous solution by changing the App/src/pages/home/report/ReportActionItemMessage/index.web.js Lines 10 to 40 in 7392208
These changes will be implemented for the web and desktop only. Complete comparison: No more flickering: Recording.43.mp4 |
I don't prefer adding another wrapper, I wanna wait to see if someone can find the root cause and propose a more simpler solution. |
@thesahindia presumably you believe this is a regression, right?
@wildan-m, we see the issue on the desktop app as well (not just in the Web browser), so how can that be the case? |
What I was trying to understand is why @wildan-m, can you please test that your solution will work on all platforms? |
@thesahindia It's committed 16 days ago. It might be merged into chrome but I'm not sure when. Forgot to add git diff src/styles/styles.js
diff --git a/src/styles/styles.js b/src/styles/styles.js
index f2d7cff023..ff418ef535 100644
--- a/src/styles/styles.js
+++ b/src/styles/styles.js
@@ -1236,6 +1236,8 @@ const styles = {
appContent: {
backgroundColor: themeColors.appBG,
overflow: 'hidden',
+ userSelect: 'auto',
+ WebkitUserSelect: 'auto',
},
appContentHeader: { I've tested it on the web (chrome, FF, Safari), and desktop and the result is OK. Note: |
@thesahindia just tested it on iOS. The result is OK |
The codepen example has the same issue so it's confirmed that App/src/pages/home/ReportScreen.js Lines 235 to 236 in e09d228
C+ reviewed 🎀👀🎀 cc: @chiragsalian |
Proposal LGTM, feel free to create the PR @wildan-m. |
📣 @wildan-m You have been assigned to this job by @chiragsalian! |
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:
|
Alrighty, time to settle up! Payments due: $1000 - @wildan-m (C) - offer sent |
As for the checklist:
|
Alrighty, @wildan-m settled up! Closing, thanks everyone! 🎉 |
@trjExpensify, I think it's also eligible for the 50% bonus 😄 |
Oh, bloody hell! 😅 Sent you both contracts for that. |
Cool, all sorted. |
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:
Only the intended text selection is highlighted.
Actual Result:
The intended text select, text inside the composer input, and the menu on the settings page are highlighted.
Workaround:
unknown
Platform:
Where is this issue occurring?
Version Number: 1.2.18-2
Reproducible in staging?: y
Reproducible in production?: y
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:
Recording.733.mp4
Screen.Recording.2022-10-19.at.21.10.57.mov
Upwork URL: https://www.upwork.com/jobs/~019c6881ba683194f2
Issue reported by: @mollfpr
Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1666188981167469
View all open jobs on GitHub
The text was updated successfully, but these errors were encountered: