Skip to content

[HOLD for payment 2023-10-30] [$500] Log in - Keyboard is not consistent in safari and pressing enter does not submit a form #28569

Closed

Description

@lanitochka17

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 sign in page
  2. Enter any email
  3. Notice that keyboard in native ios app and safari web is not the same

Expected Result:

Both keyboard should be the same, or at least pressing "Go" should submit a form

Actual Result:

Keyboards are not consistent.
a) In safari instead of "Return" sign it says "Go"
b) And pressing it won't submit the form unlike the native app

Workaround:

Unknown

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.75-8

Reproducible in staging?: Yes

Reproducible in production?: Yes

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

Safari

Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-09-30.at.14.36.21.mp4

IOS app

Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-09-30.at.19.14.41.mp4
0-02-01-e5f3ab9fd9fe8e1dc8753548fa3c0dff6684080e6559b01a5fe4cb4038681009_4347d5f6cdd36b14.mp4

Expensify/Expensify Issue URL:

Issue reported by: @alitoshmatov

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1696083514018509

n+is%3Aissue+label%3A%22Help+Wanted%22)

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01d106743c23a6474e
  • Upwork Job ID: 1708590752340430848
  • Last Price Increase: 2023-10-15
  • Automatic offers:
    • Ollyws | Reviewer | 27213706
    • ZhenjaHorbach | Contributor | 27213707
    • alitoshmatov | Reporter | 27213710

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 1, 2023
  2. changed the title [-]Log in - Keyboard is not consistent in safari and pressing enter does not submit a form[/-] [+][$500] Log in - Keyboard is not consistent in safari and pressing enter does not submit a form[/+] on Oct 1, 2023
  3. melvin-bot commented on Oct 1, 2023

    @melvin-bot
  4. melvin-bot commented on Oct 1, 2023

    @melvin-bot

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

  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 1, 2023
  6. melvin-bot commented on Oct 1, 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. melvin-bot commented on Oct 1, 2023

    @melvin-bot

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

  8. ZhenjaHorbach commented on Oct 1, 2023

    @ZhenjaHorbach
    Contributor

    Proposal

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

    Confirm buttons have different names

    and pressing enter does not submit a form on safari web (Not reproduce on emulator and live device)

    What is the root cause of that problem?

    We don't pass returnKeyType value for choosing submit button name

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

    we can pass returnKeyType="done" or other available name for this component

    <TextInput
    ref={input}
    label={translate('loginForm.phoneOrEmail')}
    accessibilityLabel={translate('loginForm.phoneOrEmail')}
    accessibilityRole={CONST.ACCESSIBILITY_ROLE.TEXT}
    value={login}
    autoCompleteType="username"
    textContentType="username"
    nativeID="username"
    name="username"
    onChangeText={onTextInput}
    onSubmitEditing={validateAndSubmitForm}
    autoCapitalize="none"
    autoCorrect={false}
    keyboardType={CONST.KEYBOARD_TYPE.EMAIL_ADDRESS}
    errorText={formErrorText}
    hasError={hasError}
    maxLength={CONST.LOGIN_CHARACTER_LIMIT}
    />

    What alternative solutions did you explore? (Optional)

    NA

  9. neonbhai commented on Oct 2, 2023

    @neonbhai
    Contributor

    Proposal

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

    The enter key text is not consistent across platforms.

    What is the root cause of that problem?

    We don't explicitly set the text for enter key in virtual keyboards. So the keyboards tries to gauge the context on its own, resulting in inconsistent behaviour.

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

    We should set the enterKeyHint prop for the TextInput here:

    <TextInput
    ref={input}
    label={translate('loginForm.phoneOrEmail')}
    accessibilityLabel={translate('loginForm.phoneOrEmail')}

    This prop controls the value of text on enter key.

    The possible values are:

    • enter
    • done
    • next
    • search
    • send

    Reference

    I will suggest adding next.

    • enterKeyHint always has precedence over returnKeyType.
    • returnKeyType has ios-styling options, which could term it as ios focused prop, whereas,
    • enterKeyHint is a global HTML attribute. Ref

    What alternative solutions did you explore? (Optional)

    xx

  10. tienifr commented on Oct 2, 2023

    @tienifr
    Contributor

    Proposal

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

    Keyboards are not consistent.

    1. Pressing it won't submit the form unlike the native app
    2. In safari instead of "Return" sign it says "Go"

    What is the root cause of that problem?

    1. In here, we're not executing the keyboard listener callback (early return), but it still triggers the preventDefault here. When preventDefault is triggered, the onSubmitEditing is not triggered, causing the form to not submit.
    2. We're not specifying the returnKeyType/enterKeyHint in the TextInput here, so the browser will infer the value, which is different from native.

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

    1. We need to make sure the preventDefault is not executed if the callback is not executed.

    This can be done by a few ways:
    a. [Recommended] The callback will now return a boolean indicating if it's executed or not. For example return false here (and return true at the last)
    In here, we only call preventDefault if the callback is executed

    let isExecuted = false;
    
    if (_.isFunction(callback.callback)) {
        isExecuted = callback.callback(event) !== false;
    }
    if (isExecuted && callback.shouldPreventDefault) {
        event.preventDefault();
    }
    

    b. Or we can pass shouldPreventDefault false when we register that listener
    c. Or to make sure the component is not rendered prematurely on login screen, so no listener is registered, however this might still impact other inputs once that component is rendered after we login.

    1. We can just add returnKeyType (better because it's cross platform) or enterKeyHint to the TextInput, I think next is appropriate

    What alternative solutions did you explore? (Optional)

    Other inputs might have the same issue, we might want to double check and fix similar to above.

    Currently all onSubmitEditing in the app does not work due to the above issues, but the issue doesn't show up because the submission is also handled by the Form button. So an alternative is we can remove all usage of onSubmitEditing as a cleanup.

  11. ayazalavi commented on Oct 2, 2023

    @ayazalavi
    Contributor

    Proposal

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

    Enter key press not submitting form in iOS Safari

    What is the root cause of that problem?

    Root cause of the problem is simply there is onKeyPress handler in

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

    Adding following code in above file will ensure key press will be handled on pressing enter key.
    onKeyPress={({nativeEvent}) => nativeEvent.code === "Enter" && validateAndSubmitForm()}

    enterKeyHint/returnKeyType will simply set text label of return button, it will not submit form unless we have keypress handler attached to the textinput over which soft keyboard is being shown.

    It should work on all platforms but it still needs to be cross verified if C+ picks this proposal.

    Result

    Untitled.13.mp4

    What alternative solutions did you explore? (Optional)

    N/A

  12. 40 remaining items

  13. melvin-bot commented on Oct 20, 2023

    @melvin-bot

    Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

    • when @ZhenjaHorbach got assigned: 2023-10-16 05:41:50 Z
    • when the PR got merged: 2023-10-20 09:48:34 UTC
    • days elapsed: 4

    On to the next one 🚀

  14. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Oct 23, 2023
  15. changed the title [-][$500] Log in - Keyboard is not consistent in safari and pressing enter does not submit a form[/-] [+][HOLD for payment 2023-10-30] [$500] Log in - Keyboard is not consistent in safari and pressing enter does not submit a form[/+] on Oct 23, 2023
  16. melvin-bot commented on Oct 23, 2023

    @melvin-bot

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

  17. melvin-bot commented on Oct 23, 2023

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.88-11 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 2023-10-30. 🎊

    After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

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

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

    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
  18. melvin-bot commented on Oct 23, 2023

    @melvin-bot

    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:

    • [@Ollyws] The PR that introduced the bug has been identified. Link to the PR:
    • [@Ollyws] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
    • [@Ollyws] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
    • [@Ollyws] Determine if we should create a regression test for this bug.
    • [@Ollyws] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
    • [@stephanieelliott] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  19. Ollyws commented on Oct 30, 2023

    @Ollyws
    Contributor
    • The PR that introduced the bug has been identified. Link to the PR:

    We can't really say this was a regression from any PR, we just never added the returnKeyType to the login form.

    • The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:

    N/A

    • A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:

    N/A

    • Determine if we should create a regression test for this bug.

    I don't think a regression test would be helpful here as it's a very minor visual inconsistency that doesn't affect the flow in any meaningful way.

  20. stephanieelliott commented on Oct 30, 2023

    @stephanieelliott
    Contributor

    Summarizing payment on this issue:

    Upwork job is here, no bonus is included on payout

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions