Skip to content

[$500] Focus on edit when keyboard shortcut is open using CTRL+J #29610

Closed

Description

@kbecciv

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.3.84.0
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: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1697207528874409

Action Performed:

  1. Open the app
  2. Open any report
  3. Send any message
  4. Edit the message
  5. Remove all text from message and press enter, it should open delete popup
  6. Press CTRL+J/CMD+J and observe that keyboard shortcut is opened but we can type in edit message

Expected Result:

App should not keep focus on edit message when we open keyboard shortcut using CTRL+J

Actual Result:

App keeps focus on edit message even when we open keyboard shortcut using CTRL+J

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
windows.chrome.edit.focus.on.CTRL.J.mp4
mac.chrome.CTRL.J.edit.focus.mov
Recording.4992.mp4
MacOS: Desktop
mac.desktop.CTRL.J.edit.focus.mov

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0141276117edef8487
  • Upwork Job ID: 1713214201330978816
  • Last Price Increase: 2023-10-28
  • Automatic offers:
    • situchan | Contributor | 27503041
    • dhanashree-sawant | Reporter | 27503043

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 14, 2023
  2. abdel-h66 commented on Oct 14, 2023

    @abdel-h66
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When the delete comment modal is open, opening the right-hand navigation put the focus back on the comment edit field.

    What is the root cause of that problem?

    When the delete modal is canceled, it will automatically call the onClose callback that does the following:

    ReportActionContextMenu.showDeleteModal(props.reportID, props.action, false, deleteDraft, () => InteractionManager.runAfterInteractions(() => textInputRef.current.focus()));

    So, in summary, the Right-hand navigation when opened it dismisses any open modals, causing the Delete modal onCancel callback to be triggered. And in our case it puts the focus back on the Text input.

    What changes do you think we should make in order to solve the problem?

    Since I could not find a way to differentiate between the modal being closed by the user, or by Navigation, I decided to check for the active route when the action occurs.

    So by checking if the active route is actual report using

        const isReportRoute = Navigation.getActiveRoute().includes(`/r/${props.reportID}`)

    We can then blur the text input whenever the route is not a report.

        useEffect(() => {
            if(isReportRoute) {
                return;
            }
    
            textInputRef.current.blur()
        }, [isReportRoute])
        

    What alternative solutions did you explore? (Optional)

    I tried to update the onClose callback to this

        const handleOnDeleteModalCancel = useCallback(() => {
            if(!isReportRoute) {
                return;
            }
            InteractionManager.runAfterInteractions(() => textInputRef.current.focus());
        }, [isReportRoute])

    This didn't work due to the fact that the modal is closed before the route changes. Meaning isReportRoute will always be true.

    N/A

  3. melvin-bot commented on Oct 14, 2023

    @melvin-bot

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

  4. changed the title [-] Focus on edit when keyboard shortcut is open using CTRL+J[/-] [+][$500] Focus on edit when keyboard shortcut is open using CTRL+J[/+] on Oct 14, 2023
  5. melvin-bot commented on Oct 14, 2023

    @melvin-bot
  6. melvin-bot commented on Oct 14, 2023

    @melvin-bot

    Bug0 Triage Checklist (Main S/O)

    • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
    • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
      • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
    • This bug is reproducible using the reproduction steps in the OP. S/O
      • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
      • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
    • This issue is filled out as thoroughly and clearly as possible
      • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
    • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync
  7. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 14, 2023
  8. melvin-bot commented on Oct 14, 2023

    @melvin-bot

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

  9. getusha commented on Oct 14, 2023

    @getusha
    Contributor

    @abdel-h66 @ArekChr just to drop a note here, we shouldn't use InteractionManager it will cause bugs after we upgrade react-native-web to the latest version, we experienced issues like this one #24482 (comment).

  10. abdel-h66 commented on Oct 14, 2023

    @abdel-h66
    Contributor

    Does it mean we are dropping the InteractionManager @getusha ? That was coming from the original implem by the way.

  11. getusha commented on Oct 14, 2023

    @getusha
    Contributor

    @abdel-h66 we have to, most of the time its solving issues because it wraps the callback passed in setTimeout, now it uses a task queue which is not ideal to handle input focus.

  12. 174 remaining items

  13. tsa321 commented on Mar 29, 2024

    @tsa321
    Contributor
  14. hayata-suenaga commented on Apr 1, 2024

    @hayata-suenaga
    Contributor

    Zany has been OOO. She will come back online this week. Please wait a little bit for that 🙇 @tsa321

  15. zanyrenney commented on Apr 2, 2024

    @zanyrenney
    Contributor

    Hi @tsa321 I have just sent you a manual offer for the job, please accept.

  16. zanyrenney commented on Apr 2, 2024

    @zanyrenney
    Contributor

    @hayata-suenaga thanks for the message above, appreciate it! <3

  17. zanyrenney commented on Apr 2, 2024

    @zanyrenney
    Contributor

    not overdue!

  18. tsa321 commented on Apr 3, 2024

    @tsa321
    Contributor

    Thank you @zanyrenney , I have accepted the offer

  19. hayata-suenaga commented on Apr 12, 2024

    @hayata-suenaga
    Contributor

    waiting for payment

  20. zanyrenney commented on Apr 29, 2024

    @zanyrenney
    Contributor

    payment summary

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringInternalRequires API changes or must be handled by Expensify staffWeeklyKSv2

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions