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 #20353] [$1000] Enter key isn’t creating new line for new members invitation message textinput #18419

Closed
1 of 6 tasks
kavimuru opened this issue May 4, 2023 · 85 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@kavimuru
Copy link

kavimuru commented May 4, 2023

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. Goto Settings -> Workspaces
  2. Select any workspace
  3. Goto Manage Members -> Invite
  4. Select members and click next
  5. Observe that Enter key isn’t considered and not creating new line for the textinput

Expected Result:

It should create new line within textinput

Actual Result:

It isn’t creating new line

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.10-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
Notes/Photos/Videos: Any additional supporting documentation

Screen.Recording.2023-05-03.at.10.04.08.PM.mov
Recording.478.mp4

Expensify/Expensify Issue URL:
Issue reported by: @Pujan92
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1683131447948259

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~016a25a3c41bc6b912
  • Upwork Job ID: 1654599849268609024
  • Last Price Increase: 2023-05-26
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 4, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

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

@Pujan92
Copy link
Contributor

Pujan92 commented May 4, 2023

Proposal

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

Shift+Enter is not creating the new line for the invite message multiline textinput

What is the root cause of that problem?

Before reaching to the invite message page we are selecting the members from the invite members page, in that we have OptionsSelector which is creating a subscribe event for ENTER on componentDidMount.
Behavior of this key has been manipulated here according to the select items from the OptionsList.

componentDidMount() {
const enterConfig = CONST.KEYBOARD_SHORTCUTS.ENTER;
this.unsubscribeEnter = KeyboardShortcut.subscribe(
enterConfig.shortcutKey,
() => {
const focusedOption = this.state.allOptions[this.state.focusedIndex];
if (!focusedOption) {
return;
}
this.selectRow(focusedOption);
},
enterConfig.descriptionKey,
enterConfig.modifiers,
true,
() => !this.state.allOptions[this.state.focusedIndex],
1,
);
const CTRLEnterConfig = CONST.KEYBOARD_SHORTCUTS.CTRL_ENTER;
this.unsubscribeCTRLEnter = KeyboardShortcut.subscribe(
CTRLEnterConfig.shortcutKey,
() => {
if (this.props.canSelectMultipleOptions) {
this.props.onConfirmSelection();
return;
}
const focusedOption = this.state.allOptions[this.state.focusedIndex];
if (!focusedOption) {
return;
}
this.selectRow(focusedOption);
},
CTRLEnterConfig.descriptionKey,
CTRLEnterConfig.modifiers,
true,
);

This(OptionsSelector) component isn't unmounted as the parent component remains due to we are moving the navigation in forward dir. For this key subscribe method we are not providing excludedNodes and all these are the cause for the issue.

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

We need to provide the excludedNodes with item TextArea for these subscribe methods like the way we are providing for the Up/Down arrow keys within ArrowKeyFocusManager. With this change for textinput it won't consider OptionsSelector callback function.

}, arrowUpConfig.descriptionKey, arrowUpConfig.modifiers, true, false, 1, true, [this.props.shouldExcludeTextAreaNodes && 'TEXTAREA']);

@MelvinBot
Copy link

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.

@aldo-expensify
Copy link
Contributor

This is also broken in the main composer in staging I think

@Pujan92
Copy link
Contributor

Pujan92 commented May 4, 2023

@aldo-expensify this commit seems breaking it where closeShortcutEnterModalConfig is configured for ENTER key.

@sakluger
Copy link
Contributor

sakluger commented May 5, 2023

Checking with Aldo to see ifthat PR did cause a regression.

@aldo-expensify aldo-expensify self-assigned this May 5, 2023
@aldo-expensify
Copy link
Contributor

@Pujan92 is correct about the root cause here: #18419 (comment)

I'm not sure about what PR introduced this bug yet. The code that added the ENTER shortcut that prevents the enter key from working correctly has been there for a while:

this.unsubscribeEnter = KeyboardShortcut.subscribe(
enterConfig.shortcutKey,
() => {
const focusedOption = this.state.allOptions[this.state.focusedIndex];
if (!focusedOption) {
return;
}
this.selectRow(focusedOption);
},
enterConfig.descriptionKey,
enterConfig.modifiers,
true,
() => !this.state.allOptions[this.state.focusedIndex],
1,
);

@aldo-expensify
Copy link
Contributor

@Pujan92 's proposed solution doesn't work well in all cases. It works well if you have focused the Textarea, but if you click somewhere else and you press enter, you can still select new entries in the list that is hidden in the previous page:

Screen.Recording.2023-05-05.at.2.29.58.PM.mov

@aldo-expensify aldo-expensify added the External Added to denote the issue can be worked on by a contributor label May 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 5, 2023

Job added to Upwork: https://www.upwork.com/jobs/~016a25a3c41bc6b912

@melvin-bot melvin-bot bot changed the title Enter key isn’t creating new line for new members invitation message textinput [$1000] Enter key isn’t creating new line for new members invitation message textinput May 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 5, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 5, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 5, 2023

Current assignee @aldo-expensify is eligible for the External assigner, not assigning anyone new.

@hellohublot
Copy link
Contributor

hellohublot commented May 6, 2023

Proposal

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

Enter key isn’t creating new line for new members invitation message textinput

What is the root cause of that problem?

Because the BaseOptionsSelector is still listening for the Enter key, so line breaks have no effect

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

It may not be practical to override KeyboardShortcut, because there are some global listeners,
So we can wrap a withNavigationFocus to BaseOptionsSelector like Button,
Then we can add a parameter isEnabledFunction = () => this.props.isFocused to KeyboardShortcut.subscribe,
Then we return true if (isEnabledFunction()) in bindHandlerToKeydownEvent.every

I also suggest that we refactor KeyboardShortcut.subscribe to only have one parameter {}, because it has too many parameters, change it to one {}, and then we will know what to pass from the key, otherwise we will be confused what parameters to pass

@melvin-bot melvin-bot bot added the Overdue label May 8, 2023
@aldo-expensify
Copy link
Contributor

I also suggest that we refactor KeyboardShortcut.subscribe to only have one parameter {}, because it has too many parameters, change it to one {}, and then we will know what to pass from the key, otherwise we will be confused what parameters to pass

While I agree that it would be better that way, I think we should keep it out of the scope of this issue. If you want to pursue this change, I think it would be good to propose it in slack.

@melvin-bot melvin-bot bot removed the Overdue label May 8, 2023
@aldo-expensify
Copy link
Contributor

aldo-expensify commented May 8, 2023

I'll give some time to @rushatgabhane to check the @hellohublot 's proposal. It make sense to me, but I haven't tested it yet.

@melvin-bot
Copy link

melvin-bot bot commented May 8, 2023

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@rushatgabhane
Copy link
Member

rushatgabhane commented May 9, 2023

It may not be practical to override KeyboardShortcut

@hellohublot @aldo-expensify we can set the priority of keyboard shortcuts if I'm not wrong. Maybe we should use that?

* @param {Number} [priority] The position the callback should take in the stack. 0 means top priority, and 1 means less priority than the most recently added.

@hellohublot
Copy link
Contributor

@rushatgabhane Thanks for your suggestion, I tested [0, 1, -1], it doesn't work, because this only affects the order of multiple event callbacks, these events will still be executed

eventHandlers[displayName].splice(priority, 0, {
id: callbackID,
callback,
captureOnInputs,
shouldPreventDefault,
shouldBubble,
excludedNodes,
});

@sakluger sakluger changed the title [$1000] Enter key isn’t creating new line for new members invitation message textinput [HOLD #20353] [$1000] Enter key isn’t creating new line for new members invitation message textinput Jul 11, 2023
@sakluger sakluger added Weekly KSv2 and removed Daily KSv2 labels Jul 11, 2023
@sakluger
Copy link
Contributor

Sounds good - I've added the hold and moved to weekly while we wait for the other issue.

@melvin-bot melvin-bot bot added the Overdue label Jul 19, 2023
@sakluger
Copy link
Contributor

Still on hold for #20353.

@melvin-bot melvin-bot bot removed the Overdue label Jul 19, 2023
@melvin-bot melvin-bot bot added the Overdue label Jul 28, 2023
@aldo-expensify
Copy link
Contributor

Same ^

@melvin-bot melvin-bot bot removed the Overdue label Aug 1, 2023
@melvin-bot melvin-bot bot added the Overdue label Aug 9, 2023
@sakluger
Copy link
Contributor

sakluger commented Aug 9, 2023

Still on hold.

@melvin-bot melvin-bot bot removed the Overdue label Aug 9, 2023
@melvin-bot melvin-bot bot added the Overdue label Aug 21, 2023
@aldo-expensify
Copy link
Contributor

Still on hold.

@melvin-bot melvin-bot bot removed the Overdue label Aug 21, 2023
@melvin-bot melvin-bot bot added the Overdue label Aug 30, 2023
@aldo-expensify
Copy link
Contributor

Same ^

@melvin-bot melvin-bot bot removed the Overdue label Sep 1, 2023
@melvin-bot melvin-bot bot added the Overdue label Sep 11, 2023
@aldo-expensify
Copy link
Contributor

@koko57 seems like #20353 is finished, should we remove the HOLD here and investigate what needs to be done?

@melvin-bot melvin-bot bot removed the Overdue label Sep 11, 2023
@koko57
Copy link
Contributor

koko57 commented Sep 11, 2023

@aldo-expensify yeah, of course! I think we should get back to it. 🙂

@koko57
Copy link
Contributor

koko57 commented Sep 11, 2023

Cannot recreate either on staging or prod

Screen.Recording.2023-09-11.at.18.11.04.mov

@aldo-expensify
Copy link
Contributor

@koko57 thanks for testing, I also tried now and it is working for me aswell

Screen.Recording.2023-09-12.at.9.39.34.AM.mov

Should we just close this then?

@koko57
Copy link
Contributor

koko57 commented Sep 12, 2023

@aldo-expensify If you're asking me, I think yes, it can be closed now 😃

@melvin-bot melvin-bot bot added the Overdue label Sep 20, 2023
@aldo-expensify
Copy link
Contributor

@aldo-expensify If you're asking me, I think yes, it can be closed now 😃

thanks! I guess I was looking for a second opinion to confirm, closing then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests