Skip to content

[PAID] [$500] Web - Composer send button is enabled even when the input contains only space #26433

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!


Action Performed:

  1. Open any chat
  2. Type multiple spaces and verify the send button is still disabled
  3. Close the chat or navigate to another chat
  4. Open back the chat

Expected Result:

The send button stays disabled because it contains only space

Actual Result:

The send button is enabled

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.60.1
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-08-26.at.16.06.42.mov
Recording.4142.mp4

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0148ad3caa7badc613
  • Upwork Job ID: 1697749457182527488
  • Last Price Increase: 2023-09-01
  • Automatic offers:
    • fedirjh | Reviewer | 26518770
    • bernhardoj | Contributor | 26518772
    • bernhardoj | Reporter | 26518773

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 31, 2023
  2. melvin-bot commented on Aug 31, 2023

    @melvin-bot

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

  3. melvin-bot commented on Aug 31, 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
  4. kbecciv commented on Aug 31, 2023

    @kbecciv
    Author

    Proposal by: @bernhardoj
    Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1693037242762969

    Proposal

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

    The composer send button is enabled even when it contains only space.

    What is the root cause of that problem?

    We disable the send button if isCommentEmpty state is true. The initial value of isCommentEmpty comes from isCommentEmptyProp.

    const [isCommentEmpty, setIsCommentEmpty] = useState(isCommentEmptyProp);

    https://github.com/Expensify/App/blob/c16995257c738761206ea07645e863ee717ecbc0/src/pages/home/report/ReportActionCompose/ReportActionCompose.js#[…]8
    Notice that we check using _.isEmpty which considers space only as not empty. This is different from what we do when typing something in the composer.
    https://github.com/Expensify/App/blob/c16995257c738761206ea07645e863ee717ecbc0/src[…]ages/home/report/ReportActionCompose/ComposerWithSuggestions.js

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

    This issue happens after the ReportActionCompose refactor. Previously, when the composer mounted, we always called updateComment to make sure isCommentEmpty had a correct value, but this approach raised this issue.
    Even though the issue is marked as not a bug, I still think it's a bug and we shouldn't use the old approach which is a workaround. To fully solve the issue, we should replace _.isEmpty with the regex we use when typing in the composer.

    isCommentEmpty: {
        selector: (comment) => !comment || !!comment.match(/^(\s)*$/)
    // comment could be undefined, so we also use !comment
    
  5. alifhaider commented on Aug 31, 2023

    @alifhaider

    Proposal

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

    Composer send button is not disabled when typed text is only spaces

    What is the root cause of that problem?

    Send Button is only checking for disabled if field is empty or not.

    isCommentEmpty: {
    key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${reportID}`,
    selector: (comment) => _.isEmpty(comment),
    },

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

    We can trim the comment and then update isCommentEmpty. By this, it will remove the start and ending spaces of text, and then make the button enabled and disabled based on that.

    isCommentEmpty: {
                key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${reportID}`,
                selector: (comment) => _.isEmpty(comment) || _.isEmpty(comment.trim()),
            },
    

    What alternative solutions did you explore? (Optional)

    N/A

  6. melvin-bot commented on Aug 31, 2023

    @melvin-bot

    📣 @alifhaider! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  7. alifhaider commented on Aug 31, 2023

    @alifhaider

    Contributor details
    Your Expensify account email: alifhaider57@gmail.com
    Upwork Profile Link: (https://www.upwork.com/freelancers/~014066482556c551be)

  8. melvin-bot commented on Aug 31, 2023

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  9. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Sep 1, 2023
  10. changed the title [-]Web - Composer send button is enabled even when the input contains only space[/-] [+][$500] Web - Composer send button is enabled even when the input contains only space[/+] on Sep 1, 2023
  11. melvin-bot commented on Sep 1, 2023

    @melvin-bot
  12. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Sep 1, 2023
  13. 36 remaining items

  14. strepanier03 commented on Oct 6, 2023

    @strepanier03
    Contributor

    @bernhardoj - You've been paid in Upwork. I left a note on the bonus payment but I thought we had two separate contracts for this job for you so I added the bonus to pay the reporting payment after the fact. Let me know if you have any questions.

    @fedirjh - I'll keep my eyes open for an update on the checklist and move forward once there's one.

    Thanks everyone!

  15. bernhardoj commented on Oct 6, 2023

    @bernhardoj
    Contributor

    @strepanier03 got it. Thanks! I think you can close the Reporter contract then.

  16. fedirjh commented on Oct 6, 2023

    @fedirjh
    Contributor

    BugZero Checklist:


    Regression Test Proposal

    1. Open any chat
    2. Type space into the composer.
    3. Verify the send button is disabled.
    4. Switch to another chat
    5. Open the chat back
    6. Verify the send button is still disabled.
    • Do we agree 👍 or 👎
  17. fedirjh commented on Oct 6, 2023

    @fedirjh
    Contributor

    @strepanier03 The offer was expired for me, could you please send me another offer 🙏🏼

  18. strepanier03 commented on Oct 6, 2023

    @strepanier03
    Contributor

    Sure thing @fedirjh, I'll do that now.

  19. strepanier03 commented on Oct 6, 2023

    @strepanier03
    Contributor

    @fedirjh - Sent!

    Working on reg test GH now.

  20. strepanier03 commented on Oct 6, 2023

    @strepanier03
    Contributor

    @bernhardoj - I'll work on closing that next week. For some reason both contracts linked here are for the same contract and paid already.

  21. fedirjh commented on Oct 9, 2023

    @fedirjh
    Contributor

    @strepanier03 Accepted, Thank you.

  22. strepanier03 commented on Oct 9, 2023

    @strepanier03
    Contributor

    @fedirjh - I have finished paying you as well. Thanks for accepting that.

    Thank you both for being part of our community and working so hard to help us achieve the New Expensify dream.

  23. changed the title [-][HOLD for payment 2023-10-05] [$500] Web - Composer send button is enabled even when the input contains only space[/-] [+][PAID] [$500] Web - Composer send button is enabled even when the input contains only space[/+] on Oct 9, 2023
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