-
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 2022-11-29] [Hold for payment 2022-11-21] [$250] Mac / Safari : After selecting a text via mouse and then usingCMD+C
to copy it does not work reported by @parasharrajat
#12554
Comments
Triggered auto assignment to @puneetlath ( |
Current assignee @puneetlath is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat ( |
Current assignee @puneetlath is eligible for the External assigner, not assigning anyone new. |
CMD+C
to copy it does not work reported by @parasharrajatCMD+C
to copy it does not work reported by @parasharrajat
ProposalThe actual problem is in these lines of code: App/src/pages/home/report/ReportActionItem.js Lines 171 to 174 in ea35c46
This fix was made according to this PR #8443 for this issue #7853 It's unfocusing the whole message including selected text, when you press any button. So, I propose to add next condition/exception for shortcuts meta keys (CMD + Ctrl):
It's perfectly working in Safari, and other platforms. The previous issue is also fixed. CleanShot.2022-11-08.at.22.49.06.mp4 |
Good find @yevheniitsuryk. App/src/pages/home/report/ReportActionItem.js Lines 171 to 174 in ea35c46
Based on the real issue, looks like we want to disable the blue border on |
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. |
@parasharrajat actually if we remove fix with .blur(), it triggers focus on every keyPress (not only Shift key). Check it on video, on Safari all symbol keys, on Chrome literally every key (except functional keys like Ctrl/cmd alt/option): CleanShot.2022-11-09.at.10.18.11.mp4CleanShot.2022-11-09.at.12.28.14.mp4So the problem turned out to be more serious than it seemed at first) I tried to research this strange behavior with focusing on every key press, but no results for now. Also tried to fix behavior by adding more conditions (exception) on shift and tab keys, but problem is that you can't catch shift + tab shortcut - firstly you catch Shift button press, after you are catching Tab (with pressed shift).
And if we catch Shift - we make blur() for event.target element and after that we have different behaviors in browsers (Safari loses previous focusable element and then start focusing on first element on page, and Chrome loses focus on current element, but after that still able to catch previous and next focusable elements), you may check next videos: CleanShot.2022-11-09.at.12.42.59.mp4CleanShot.2022-11-09.at.12.46.20.mp4I think in this case we should solve the root of the issue - disable focusing on elements on every key press. So I'm still researching. |
Thanks for digging into this.
Does this proposal still work? And you are prefering fix the above root cause instead of this. Question:
|
Updated proposal@parasharrajat yes, this proposal works okay, it's fixing problem with text selection on messages. Answering your question - no issues with blurring on each keypress. I made modification according to your comment - now it will blur on single Shift key press, navigation on Tab and Shift+Tab works, and there is final code:
(Tested on Safari) @parasharrajat But please check this part of my previous comment, where I described different behavior on Safari and Chrome |
Ok, so you are saying that your proposal is working and has no inconsistencies across browsers. And changing the conditon(as per my request) has different effects on different browsers. I will test your solution and I think it also needs a general discussion as I don't think blurring on the key press is a good idea. May be we can seek a better solution as part of this issue. |
Proposal Instead of a blur that breaks copy, we can just add, or remove the style. Method onKeyUp needs to restore default Tab focus highlight behaviour.
|
ProposalThe <div tabindex="0" class="css-view-175oi2r r-cursor-1loqt21 r-touchAction-1otgn73" style="touch-action: auto; -webkit-user-select: none; -webkit-user-drag: none;"> The So I propose to add in this.pressableRef.setNativeProps({
tabIndex: undefined,
}); IMPORTANT: This solution is not aligned with your migration to Fabric. Read "P.S" for more details.The entire componentDidMount() {
// Prevent unwanted focusing of element (Pressable auto implements tabindex="0")
this.pressableRef.setNativeProps({
tabIndex: undefined,
});
if (this.props.forwardedRef && _.isFunction(this.props.forwardedRef)) {
this.props.forwardedRef(this.pressableRef);
}
this.pressableRef.addEventListener('contextmenu', this.executeSecondaryInteractionOnContextMenu);
} Also, this would mean that this portion of the code would be eliminated: App/src/pages/home/report/ReportActionItem.js Lines 171 to 174 in ea35c46
Leaving the It's perfectly working in Safari, and other platforms. The previous issue is also fixed. Screen.Recording.2022-11-09.at.13.12.20.movP.S.: I know you are migrating to Fabric. |
Both are interesting solutions. Resetting the style is a good idea but very hacky. @henriquefalconer Correct, we are migrating to the fabric so we can't use I will prefer the best simple solution for this task. |
Updated proposalAs requested, here's an alternate and simpler solution for this task. I propose changing the Here's what it looks like currently: App/src/components/PressableWithSecondaryInteraction/index.js Lines 67 to 81 in ed86487
And here's what it will look after my alterations: return (
<LongPressGestureHandler onHandlerStateChange={this.callSecondaryInteractionWithMappedEvent}>
<TouchableWithoutFeedback
onPressIn={this.props.onPressIn}
onPressOut={this.props.onPressOut}
onPress={this.props.onPress}
// eslint-disable-next-line react/jsx-props-no-spreading
{...defaultPressableProps}
>
<>
<View style={this.props.inline && styles.dInline} ref={el => this.pressableRef = el}>
{this.props.children}
</View>
</>
</TouchableWithoutFeedback>
</LongPressGestureHandler>
); In order for this to work, I inserted The outcome does not produce any unwanted effects, and retains all current funcionality:
P.S.: Applying this would also mean that this portion of the code could be eliminated: App/src/pages/home/report/ReportActionItem.js Lines 171 to 174 in ea35c46
It's perfectly working in Safari, and other platforms. The previous issue is also fixed. Screen.Recording.2022-11-09.at.20.14.10.mov |
Awesome @henriquefalconer that looks more reasonable to do. I will test it just to be sure first. https://github.com/Expensify/App/blob/f654cc13794aa749a29b6561bad94d80a9580fd4/src/components/PressableWithSecondaryInteraction/index.js is deeply involved in many things. |
|
Won't the @henriquefalconer proposal's remove the tabbing functionality? We can't tab thought messages? |
I think I checked that. Working great. |
@parasharrajat |
I am going to revert the Regression PR #8443 which is causing a trail of regressions. cc: @puneetlath What do you think? |
@parasharrajat Also i think we should close this issue and track only on #12010 |
I think all of these issues originated from that PR and closing it gets rids of them so it is better. If you think we should solve #7853, you can open a new discussion on slack to reopen that. Thanks. |
@parasharrajat Understood. I was for the revert at first but then I found that the issue effect every key not only SHIFT. |
Yup, I discussed that already. We are good to keep that for now. But as I said, if you have a better solution in mind, you can raise the same on slack and tag the previous issue. |
@parasharrajat I agree let's revert that. |
Alright @parasharrajat! Thanks for considering my proposal 😉 |
Unfortunately, there is no clean solution available for this. I was happy to do #12554 (comment) but it still has one issue so reverting is a good call. Looking forward to your contributions on other issues. |
📣 @rushatgabhane You have been assigned to this job by @puneetlath! |
Agreed, thanks for the engagement everyone! We look forward to continuing to work with you on other issues. |
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:
|
|
@puneetlath, @parasharrajat, @rushatgabhane Eep! 4 days overdue now. Issues have feelings too... |
@parasharrajat @rushatgabhane sent you hiring offers in Upwork. |
CMD+C
to copy it does not work reported by @parasharrajatCMD+C
to copy it does not work reported by @parasharrajat
CMD+C
to copy it does not work reported by @parasharrajatCMD+C
to copy it does not work reported by @parasharrajat
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.29-7 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 2022-11-29. 🎊 After the hold period, please check if any of the following need payment for this issue, and if so check them off after paying:
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
|
This comment was marked as duplicate.
This comment was marked as duplicate.
@rushatgabhane quick bump on accepting the hiring offer. Then we'll be able to close this out. Thanks! |
Thanks @puneetlath, accepted! |
All paid! |
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:
the selected text should be copied and pasted in the composer.
Actual Result :
Workaround:
unknown
Platform:
Where is this issue occurring?
Version Number: 1.2.24-4
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.8.mp4
Expensify/Expensify Issue URL:
Issue reported by: @parasharrajat
Slack conversation:
https://expensify.slack.com/archives/C01GTK53T8Q/p1667834088430199
View all open jobs on GitHub
The text was updated successfully, but these errors were encountered: