Skip to content
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-03-13] [$500] Workspace – Unable to save edited WS name using Enter key in newly created WS. #36923

Closed
1 of 6 tasks
lanitochka17 opened this issue Feb 20, 2024 · 20 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Feb 20, 2024

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.4.43-3
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4327666
Email or phone of affected tester (no customers): applausetester+jp_e_category@applause.expensifail.com
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Go to https://staging.new.expensify.com/
  2. Login with account that has at least 1 WS already created
  3. Click on "choose Workspace" icon in top left
  4. Create a new WS by hitting "+"
  5. Edit WS name
  6. Press Enter key to save the edited WS name

Expected Result:

Edited WS name is saved

Actual Result:

Nothing happens

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

Add any screenshot/video evidence

Bug6385818_1708442372353.Unable_to_save_edited_WS_name_using_Enter_key.1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0109e93e51a9b4c9ed
  • Upwork Job ID: 1760135649726885888
  • Last Price Increase: 2024-02-21
  • Automatic offers:
    • getusha | Reviewer | 0
    • bernhardoj | Contributor | 0
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Feb 20, 2024
Copy link

melvin-bot bot commented Feb 20, 2024

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

@Krishna2323
Copy link
Contributor

Krishna2323 commented Feb 20, 2024

Proposal

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

Workspace – Unable to save edited WS name using Enter key in newly created WS.

What is the root cause of that problem?

We don't pass disablePressOnEnter={false} to FormProvider in WorkspaceNamePage

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

Pass disablePressOnEnter={false} to FormProvider in WorkspaceNamePage

Result

@kadiealexander
Copy link
Contributor

Can't reproduce on v1.4.43-5

2024-02-21_13-54-48.mp4

@mvtglobally
Copy link

mvtglobally commented Feb 21, 2024

Able to reproduce.
Issue is repro ONLY if you already have a WS created. If you are creating 1st one its not repro

Screen.Recording.2024-02-20.at.8.53.51.PM.mov

@kadiealexander
Copy link
Contributor

Still unable to repro:

2024-02-21_15-39-18.mp4

@kadiealexander
Copy link
Contributor

Ah wait, I clicked the wrong "create a workspace" button. Was able to repro this.

@kadiealexander kadiealexander added the External Added to denote the issue can be worked on by a contributor label Feb 21, 2024
@melvin-bot melvin-bot bot changed the title Workspace – Unable to save edited WS name using Enter key in newly created WS. [$500] Workspace – Unable to save edited WS name using Enter key in newly created WS. Feb 21, 2024
Copy link

melvin-bot bot commented Feb 21, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0109e93e51a9b4c9ed

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 21, 2024
Copy link

melvin-bot bot commented Feb 21, 2024

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

@bernhardoj
Copy link
Contributor

Proposal

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

The enter key to save the workspace name doesn't work after creating a new workspace from the switcher page.

What is the root cause of that problem?

Summary: The ENTER key is captured by another page.

When we press the new workspace from the switcher page, we will be navigated to the newly created workspace page (profile).

onPress={() => {
App.createWorkspaceWithPolicyDraftAndNavigateToIt();
}}

We never pop the switcher page out from the nav stack, so it still exists on the stack. The workspace switcher page uses OptionsSelector to show the list which has its own ENTER key shortcut. We already disable the shortcut if the screen goes out of focus.

if (prevProps.isFocused !== this.props.isFocused) {
// Unregister the shortcut before registering a new one to avoid lingering shortcut listener
this.unSubscribeFromKeyboardShortcut();
if (this.props.isFocused) {
this.subscribeToEnterShortcut();
this.subscribeToCtrlEnterShortcut();
}
}

But we have another condition to subscribe it back.

if (prevState.disableEnterShortCut !== this.state.disableEnterShortCut) {
// Unregister the shortcut before registering a new one to avoid lingering shortcut listener
this.unsubscribeEnter();
if (!this.state.disableEnterShortCut) {
this.subscribeToEnterShortcut();
}
}

disableEnterShortcut is set based on focusin and focusout listener.

handleFocusIn() {
const activeElement = document.activeElement;
this.setState({
disableEnterShortCut: activeElement && this.accessibilityRoles.includes(activeElement.role) && activeElement.role !== CONST.ROLE.PRESENTATION,
});
}
handleFocusOut() {
this.setState({
disableEnterShortCut: false,
});
}

When we press the new workspace button, focusin is triggered with the new workspace button as the active element. At this time, disableEnterShortcut is true. When the newly created workspace profile page opens, focusout is called, making disableEnterShortcut becomes false. Because disableEnterShortcut is false, the ENTER shortcut key is re-registered even though the screen is not focused anymore.

This only happens when you have at least 1 workspace because if you have none, the options selector won't be rendered.

{usersWorkspaces.length > 0 ? (
<OptionsSelector

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

We have an unsubs code for the focusin and focusout, but we never use it.

unSubscribeActiveElement() {
if (!this.isWebOrDesktop) {
return;
}
document.removeEventListener('focusin', this.handleFocusIn);
document.removeEventListener('focusout', this.handleFocusOut);
}

Unsubs them when the screen is out of focus.

if (prevProps.isFocused !== this.props.isFocused) {
// Unregister the shortcut before registering a new one to avoid lingering shortcut listener
this.unSubscribeFromKeyboardShortcut();
if (this.props.isFocused) {
this.subscribeToEnterShortcut();
this.subscribeToCtrlEnterShortcut();
}
}

if (this.props.isFocused) {
} else {
    this.unSubscribeActiveElement()
}

What alternative solutions did you explore? (Optional)

Only do the subscription if isFocused is true.

if (prevState.disableEnterShortCut !== this.state.disableEnterShortCut) {
// Unregister the shortcut before registering a new one to avoid lingering shortcut listener
this.unsubscribeEnter();
if (!this.state.disableEnterShortCut) {
this.subscribeToEnterShortcut();
}
}

OR

Pop the switcher page when creating a new workspace.

onPress={() => {
App.createWorkspaceWithPolicyDraftAndNavigateToIt();
}}

I think we should do this regardless of the solution selected.

@getusha
Copy link
Contributor

getusha commented Feb 21, 2024

@bernhardoj's proposal (Main solution) looks good to me. works well.
🎀 👀 🎀 C+ Reviewed!

Copy link

melvin-bot bot commented Feb 21, 2024

Triggered auto assignment to @francoisl, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 21, 2024
Copy link

melvin-bot bot commented Feb 21, 2024

📣 @getusha 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Feb 21, 2024

📣 @bernhardoj 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@bernhardoj
Copy link
Contributor

PR is ready

cc: @getusha

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Mar 6, 2024
@melvin-bot melvin-bot bot added the Awaiting Payment Auto-added when associated PR is deployed to production label Mar 6, 2024
@melvin-bot melvin-bot bot changed the title [$500] Workspace – Unable to save edited WS name using Enter key in newly created WS. [HOLD for payment 2024-03-13] [$500] Workspace – Unable to save edited WS name using Enter key in newly created WS. Mar 6, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 6, 2024
Copy link

melvin-bot bot commented Mar 6, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Mar 6, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.47-10 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-03-13. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Mar 6, 2024

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:

@kadiealexander kadiealexander added Daily KSv2 and removed Weekly KSv2 labels Mar 12, 2024
@kadiealexander
Copy link
Contributor

@getusha don't forget the checklist!

@getusha
Copy link
Contributor

getusha commented Mar 12, 2024

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:

Regression Test Proposal

  1. Open workspace switcher page
  2. Create new workspace (+ icon)
  3. Open workspace profile page
  4. Press on the workspace name
  5. Edit the name
  6. Press enter/return
  7. Verify the name is saved and the page is closed

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 and removed Daily KSv2 labels Mar 13, 2024
@kadiealexander
Copy link
Contributor

kadiealexander commented Mar 13, 2024

Payouts due:

Upwork job is here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

7 participants