Skip to content

[HOLD for payment 2023-10-10] [$500] Web - Inconsistency bug: App adds space after emoji in composer box but does not add space after emoji in edit #27195

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 the app
  2. Open any report
  3. Type emoji text in following way: first type 2 colons and then type emoji text like joy, heart in between colons in composer box
  4. Observe that it adds space after emoji
  5. Send any normal message and edit it
  6. Type emoji text in that edit message in similar format as explained in step 3 and observe that it does not add space after emoji

Expected Result:

App should either not add space after emoji in compose box or add space after emoji in edit box to maintain consistency

Actual Result:

App adds space after emoji in compose box and does not add space after emoji in edit box

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.67.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

no.space.after.emoji.in.edit.mp4
Recording.4402.mp4

Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1694176420343339

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0195c2171640e5c29b
  • Upwork Job ID: 1701328787879800832
  • Last Price Increase: 2023-09-25
  • Automatic offers:
    • neg-0 | Contributor | 26880380
    • dhanashree-sawant | Reporter | 26880383

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 11, 2023
  2. changed the title [-]Web - Inconsistency bug: App adds space after emoji in composer box but does not add space after emoji in edit[/-] [+][$500] Web - Inconsistency bug: App adds space after emoji in composer box but does not add space after emoji in edit[/+] on Sep 11, 2023
  3. melvin-bot commented on Sep 11, 2023

    @melvin-bot
  4. melvin-bot commented on Sep 11, 2023

    @melvin-bot

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

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

    @melvin-bot

    Triggered auto assignment to @trjExpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

  8. melvin-bot commented on Sep 11, 2023

    @melvin-bot

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

  9. Krishna2323 commented on Sep 11, 2023

    @Krishna2323
    Contributor

    Proposal

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

    Web - Inconsistency bug: App adds space after emoji in composer box but does not add space after emoji in edit

    What is the root cause of that problem?

    We are not adding spaces captured by emoji when we are setting selection.

    setDraft((prevDraft) => {
    if (newDraftInput !== newDraft) {
    setSelection((prevSelection) => {
    const remainder = prevDraft.slice(prevSelection.end).length;
    return {
    start: newDraft.length - remainder,
    end: newDraft.length - remainder,
    };
    });
    }
    return newDraft;
    });

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

    We need to add spaces captured by emojis with newDraft length and then subtract it.

                setDraft((prevDraft) => {
                    if (newDraftInput !== newDraft) {
                        setSelection((prevSelection) => {
                            const remainder = prevDraft.slice(prevSelection.end).length;
                            return {
                                start: newDraft.length + emojis.length - remainder,
                                end: newDraft.length + emojis.length  - remainder,
                            };
                        });
                    }
                    return newDraft;
                });
    

    Result:

    fixed.mp4
  10. neg-0 commented on Sep 11, 2023

    @neg-0
    Contributor

    Proposal

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

    There's an inconsistency between the compose and edit boxes. When typing out an emoji there is sometimes a space after and sometimes not.

    What is the root cause of that problem?

    There is a difference in the way the selection pointer is calculated in the ReportActionItemMessageEdit editor box vs the ComposerWithSuggestions composer box.

    Editor:

    setDraft((prevDraft) => {
    if (newDraftInput !== newDraft) {
    setSelection((prevSelection) => {
    const remainder = prevDraft.slice(prevSelection.end).length;
    return {
    start: newDraft.length - remainder,
    end: newDraft.length - remainder,
    };
    });
    }

    Composer:

    setIsCommentEmpty(!!newComment.match(/^(\s)*$/));
    setValue(newComment);
    if (commentValue !== newComment) {
    const remainder = ComposerUtils.getCommonSuffixLength(commentRef.current, newComment);
    setSelection({
    start: newComment.length - remainder,
    end: newComment.length - remainder,
    });
    }

    Note the Composer uses the ComposerUtils.getCommonSuffixLength to calculate the cursor position.

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

    By utilizing the same ComposerUtils.getCommonSuffixLength function inside of the editor box, the cursor position is calculated correctly.

    image

    Recording.2023-09-11.174251.mp4

    What alternative solutions did you explore? (Optional)

    We could also create a separate helper function so that we do not use "composer" utils alongside an editor component, however, it would be a duplication of code.

  11. 39 remaining items

  12. melvin-bot commented on Oct 3, 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:

    • [@eVoloshchak] The PR that introduced the bug has been identified. Link to the PR:
    • [@eVoloshchak] 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:
    • [@eVoloshchak] 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:
    • [@eVoloshchak] Determine if we should create a regression test for this bug.
    • [@eVoloshchak] 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.
    • [@mallenexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  13. eVoloshchak commented on Oct 11, 2023

    @eVoloshchak
    Contributor
    • The PR that introduced the bug has been identified. Link to the PR: Improved selection placement when emoji is typed #22827
    • 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: https://github.com/Expensify/App/pull/22827/files#r1355100751
    • 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: we already have an item in reviewer checklist to catch this (If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic), this was just a case that was missed during implementation
    • Determine if we should create a regression test for this bug.
      This is a very minor bug, an edge case that a few users would have ever encountered. In addition to that, it doesn't prevent users from using the app. I don't think a regression test is needed here
  14. eVoloshchak commented on Oct 16, 2023

    @eVoloshchak
    Contributor

    Requested the $500 payment via NewDot

  15. mallenexpensify commented on Oct 16, 2023

    @mallenexpensify
    Contributor

    Issue reporter: @dhanashree-sawant paid $50 via Upwork
    Contributor: @neg-0 paid $500 via Upwork
    Contributor+: @eVoloshchak due $500 via NewDot

    @eVoloshchak err on the side of proposing to create regression tests because QA/Applause keeps a separate doc/list of edge cases they check once a month. Thx

  16. JmillsExpensify commented on Oct 16, 2023

    @JmillsExpensify
    Contributor

    $500 payment approved for @eVoloshchak based on summary above.

  17. eVoloshchak commented on Oct 16, 2023

    @eVoloshchak
    Contributor

    Regression Test Proposal

    1. Open the app
    2. Open any report
    3. Type an emoji text in the following way: first type 2 colons and then type emoji text like joy, heart in between colons in the composer box (i.e. :joy:)
    4. Verify that the space is added after the emoji
    5. Send any normal message and edit it
    6. While editing, type an emoji in similar format as explained in step 3
    7. Verify that the space is added after the emoji

    Do we agree 👍 or 👎

  18. JmillsExpensify commented on Oct 16, 2023

    @JmillsExpensify
    Contributor

    Re-opening for the regression test.

  19. mallenexpensify commented on Oct 17, 2023

    @mallenexpensify
    Contributor
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