Skip to content

[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

Closed

Description

@kavimuru

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:

  1. Go to any chat
  2. Select a part of any message
  3. Use shortcuts to copy the text.
  4. Try pasting the text in the composer.

Expected Result:

the selected text should be copied and pasted in the composer.

Actual Result :

  1. Select part of the old message, right click my mouse, our context menu shows rather than the browser's menu, click Copy to Clipboard, and paste into input area, the whole message been pasted, not the selection text.
  2. Select part of the old message, press Cmd+C to copy selection, and press Cmd+V or the browser's menu to paste into input area, nothing been pasted.

Workaround:

unknown

Platform:

Where is this issue occurring?

  • Web

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

Activity

  1. added
    Daily
    Bug
    on Nov 8, 2022
  2. melvin-bot commented on Nov 8, 2022

    @melvin-bot

    Triggered auto assignment to @puneetlath (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

  3. added
    External
    on Nov 8, 2022
  4. melvin-bot commented on Nov 8, 2022

    @melvin-bot

    Current assignee @puneetlath is eligible for the External assigner, not assigning anyone new.

  5. melvin-bot commented on Nov 8, 2022

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (External)

  6. added
    Help Wanted
    on Nov 8, 2022
  7. melvin-bot commented on Nov 8, 2022

    @melvin-bot

    Current assignee @puneetlath is eligible for the External assigner, not assigning anyone new.

  8. changed the title [-]Mac / Safari : After selecting a text via mouse and then using`CMD+C` to copy it does not work reported by @parasharrajat[/-] [+][$250] Mac / Safari : After selecting a text via mouse and then using`CMD+C` to copy it does not work reported by @parasharrajat[/+] on Nov 8, 2022
  9. yevheniitsuryk commented on Nov 8, 2022

    @yevheniitsuryk

    Proposal

    The actual problem is in these lines of code:

    onKeyDown={(event) => {
    // Blur the input after a key is pressed to keep the blue focus border from appearing
    event.target.blur();
    }}

    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):

    onKeyDown={(event) => {
        if (event.metaKey) { return; }
        event.target.blur();
    }}
    

    It's perfectly working in Safari, and other platforms. The previous issue is also fixed.

    CleanShot.2022-11-08.at.22.49.06.mp4
  10. parasharrajat commented on Nov 8, 2022

    @parasharrajat
    Member

    Good find @yevheniitsuryk.

    onKeyDown={(event) => {
    // Blur the input after a key is pressed to keep the blue focus border from appearing
    event.target.blur();
    }}
    looks very problematic to me. It could have many unknown side-effects. This issue is just one of them.

    Based on the real issue, looks like we want to disable the blue border on Shift+click or say it Shift only. So What about we restrict this keyDown handler to these combinations? It is important that this blue border is shown when the user uses Shift+Tab or Tab` for navigation.

  11. melvin-bot commented on Nov 8, 2022

    @melvin-bot

    Looks like something related to react-navigation may have been mentioned in this issue discussion.

    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 DeprecatedCustomActions.js files should not be accepted.

    Feel free to drop a note in #expensify-open-source with any questions.

  12. yevheniitsuryk commented on Nov 9, 2022

    @yevheniitsuryk

    @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.mp4
    CleanShot.2022-11-09.at.12.28.14.mp4

    So 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).

                    onKeyDown={(event) => {
                        console.log('event', event)
    
                        if (event.metaKey || (event.shiftKey && event.keyCode === 9) || event.keyCode === 9) { return; }
    
                        event.target.blur();
                    }}
    

    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.mp4
    CleanShot.2022-11-09.at.12.46.20.mp4

    I 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.

  13. 37 remaining items

  14. melvin-bot commented on Nov 21, 2022

    @melvin-bot

    @puneetlath, @parasharrajat, @rushatgabhane Eep! 4 days overdue now. Issues have feelings too...

  15. puneetlath commented on Nov 21, 2022

    @puneetlath
    Contributor
  16. changed the title [-][$250] Mac / Safari : After selecting a text via mouse and then using`CMD+C` to copy it does not work reported by @parasharrajat[/-] [+][Hold for payment 2022-11-21] [$250] Mac / Safari : After selecting a text via mouse and then using`CMD+C` to copy it does not work reported by @parasharrajat[/+] on Nov 21, 2022
  17. added
    Weekly
    Awaiting Payment
    and removed
    Daily
    on Nov 22, 2022
  18. changed the title [-][Hold for payment 2022-11-21] [$250] Mac / Safari : After selecting a text via mouse and then using`CMD+C` to copy it does not work reported by @parasharrajat[/-] [+][HOLD for payment 2022-11-29] [Hold for payment 2022-11-21] [$250] Mac / Safari : After selecting a text via mouse and then using`CMD+C` to copy it does not work reported by @parasharrajat[/+] on Nov 22, 2022
  19. melvin-bot commented on Nov 22, 2022

    @melvin-bot

    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:

    • External issue reporter
    • Contributor that fixed the issue
    • Contributor+ that helped on the issue and/or PR

    As a reminder, here are the bonuses/penalties that should be applied for any External issue:

    • Merged PR within 3 business days of assignment - 50% bonus
    • Merged PR more than 9 business days after assignment - 50% penalty
  20. melvin-bot commented on Nov 22, 2022

    @melvin-bot
  21. puneetlath commented on Nov 22, 2022

    @puneetlath
    Contributor

    @rushatgabhane quick bump on accepting the hiring offer. Then we'll be able to close this out. Thanks!

  22. rushatgabhane commented on Nov 23, 2022

    @rushatgabhane
    Member

    Thanks @puneetlath, accepted!

  23. puneetlath commented on Nov 28, 2022

    @puneetlath
    Contributor

    All paid!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugExternalWeekly

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions