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 2023-06-19] [$1000] IOS - Chat - Top of the emoji inside the inline block is cut off #19922

Closed
1 of 6 tasks
kbecciv opened this issue May 31, 2023 · 40 comments
Closed
1 of 6 tasks
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

@kbecciv
Copy link

kbecciv commented May 31, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Start iOS App and login with any account
  2. Open any chat
  3. Post inline block with text and some emoji like ⁦Text Block Emoji-1 Emoji-2 Emoji-3 ...

Expected Result:

The content of the inline block is fully visible

Actual Result:

Top of the emoji inside the inline block is cut off

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,21.1

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

Bug6075918_inline-block-emoji-cut-off.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01b27ea19fc8522167
  • Upwork Job ID: 1664657301634904064
  • Last Price Increase: 2023-06-02
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 31, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 31, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 31, 2023

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

@AlexanderDmitriev
Copy link

Proposal

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

IOS - Chat - Top of the emoji inside the inline block is cut off

What is the root cause of that problem?

Heights are small for inline code block elements

const codeWordWrapper = {
height: 20,
justifyContent: 'center',
};
const codeWordStyle = {
height: 16,
top: 4,
};
const codeTextStyle = {
lineHeight: 15,
};

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

Adjust height, lineHeight properly

const codeWordWrapper = {
    height: 30,
};

const codeWordStyle = {
    height: 30,
    top: 4,
};

const codeTextStyle = {
    lineHeight: 30,
};

Result

image

What alternative solutions did you explore? (Optional)

N/A

@flaviadefaria flaviadefaria added the External Added to denote the issue can be worked on by a contributor label Jun 2, 2023
@melvin-bot melvin-bot bot changed the title IOS - Chat - Top of the emoji inside the inline block is cut off [$1000] IOS - Chat - Top of the emoji inside the inline block is cut off Jun 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 2, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01b27ea19fc8522167

@melvin-bot
Copy link

melvin-bot bot commented Jun 2, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 2, 2023

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

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

melvin-bot bot commented Jun 2, 2023

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

@s-alves10
Copy link
Contributor

s-alves10 commented Jun 2, 2023

Proposal

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

When emoji is inside the inline block, emoji is cut off in iOS

What is the root cause of that problem?

We're using WrappedText for iOS/Android native in rendering inline code blocks.

In WrappedText, we split all text segments by newline and space characters and render them separately.

const textMatrix = getTextMatrix(props.children);
return (
<>
{_.map(textMatrix, (rowText, rowIndex) => (
<Fragment
// eslint-disable-next-line react/no-array-index-key
key={`${rowText}-${rowIndex}`}
>
{_.map(rowText, (colText, colIndex) => (
// Outer View is important to vertically center the Text
<View
// eslint-disable-next-line react/no-array-index-key
key={`${colText}-${colIndex}`}
style={styles.codeWordWrapper}
>
<View style={[props.wordStyles, colIndex === 0 && styles.codeFirstWordStyle, colIndex === rowText.length - 1 && styles.codeLastWordStyle]}>
<Text style={props.textStyles}>{colText}</Text>
</View>
</View>
))}
</Fragment>
))}
</>
);

This works for normal texts but works weird when there are emojis.

image

In the above screenshot, red rectangles show this. This is one of the reason.

Yellow rectangle shows that emojis has bigger size than normal text. Now the fontSize is 13, height is 16, and lineHeight is 15. This is not enough. This is another reason of this issue.

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

  1. Update the regular expression for splitting sentences.
    Now we are getting columns by splitting a line with space character
    function getTextMatrix(text) {
    return _.map(text.split('\n'), (row) => _.without(row.split(/(\s)/), ''));
    }

When there are no spaces between emoji and character, they would become a word, for example 👌You're. We need to split emoji and other characters. We can do this by dividing the splitting logic into 2 parts: emojis and characters.

    return _.map(text.split('\n'), (row) => _.without(row.split(CONST.REGEX.EMOJI_WORD_SPLITTER), ''));

In the above code, EMOJI_SPLITTER is defined in CONST.js as follows.

        EMOJI_WORD_SPLITTER: /(\s+|(?:[\p{Extended_Pictographic}\u200d\u{1f1e6}-\u{1f1ff}\u{1f3fb}-\u{1f3ff}\u{e0020}-\u{e007f}\u20E3\uFE0F]|[#*0-9]\uFE0F?\u20E3)+)/gu,
  1. Now wrapper height is 16, line height is 15. Increase both to 18. Increase code word wrapper height to 22(20 now)
Result

image

What alternative solutions did you explore? (Optional)

@s77rt
Copy link
Contributor

s77rt commented Jun 2, 2023

@AlexanderDmitriev Thanks for the proposal. Your RCA is correct and the fix makes sense to me but let's adjust the values just slightly (18 seems good enough).

🎀 👀 🎀 C+ reviewed

cc @flodnv

Edit: Looks we have another bug that we may fix here as well.

@s77rt
Copy link
Contributor

s77rt commented Jun 2, 2023

@s-alves10 Thanks for the proposal. I don't see how the matrix is relevant here. Can you elaborate on this? As far as I can tell the bug is mostly due to the wrong line height (and height).

@s-alves10
Copy link
Contributor

@s77rt
Please check the below image carefully. Not a simple line height issue

image

@s77rt
Copy link
Contributor

s77rt commented Jun 2, 2023

@s-alves10 I'm sorry, I don't get it. Can you please rephrase what you are trying to say here? As far as I tested adjusting the height and line height values seems enough, am I missing something here? i.e. what kind of a bug is still existing after those changes?

@s-alves10
Copy link
Contributor

@s77rt
Please check 👌You're welcome part. text vertical align. They are rendered separately

@s77rt
Copy link
Contributor

s77rt commented Jun 2, 2023

Oh right. This seems a little different issue but we should probably handle it here. I wonder why each word is rendered separately, that's weird.

@s-alves10
Copy link
Contributor

@s77rt
This was from the beginning of the inline code block implementation. Please check

const textMatrix = getTextMatrix(props.children);
return (
<>
{_.map(textMatrix, (rowText, rowIndex) => (
<Fragment
// eslint-disable-next-line react/no-array-index-key
key={`${rowText}-${rowIndex}`}
>
{_.map(rowText, (colText, colIndex) => (
// Outer View is important to vertically center the Text
<View
// eslint-disable-next-line react/no-array-index-key
key={`${colText}-${colIndex}`}
style={styles.codeWordWrapper}
>
<View style={[props.wordStyles, colIndex === 0 && styles.codeFirstWordStyle, colIndex === rowText.length - 1 && styles.codeLastWordStyle]}>
<Text style={props.textStyles}>{colText}</Text>
</View>
</View>
))}
</Fragment>
))}
</>
);

@s77rt
Copy link
Contributor

s77rt commented Jun 3, 2023

@s-alves10 It don't seem to be something from the beginning. This was added by #2307 to fix #986. Rendering everything in one row makes the text overflows.

Matrix Rows Only

@s-alves10
Copy link
Contributor

Proposal

Updated

@s77rt
Yes, you're right. I updated my proposal

@s77rt
Copy link
Contributor

s77rt commented Jun 5, 2023

@s-alves10 Thanks for the update. Using \b as the separator makes sense but this will create more columns than necessary and will cause text to break in places where it should not, example: test you're you're you're you're you're.

Break on spaces Break on word boundaries

@s-alves10
Copy link
Contributor

Proposal

Updated

@s77rt

Thank you for your feedback.
Yes, you're right. I was thinking how to optimize the splitting.
I think the updated proposal can solve the issue perfectly.

@s77rt
Copy link
Contributor

s77rt commented Jun 5, 2023

@s-alves10 Thanks for the quick follow up. So the idea is to split on both spaces and emojis? Your regex seems a little complicated, can you please update it and use our existing EMOJIS regex or better create a new regex SPACE_OR_EMOJI (similar to SPECIAL_CHAR_OR_EMOJI).

@s-alves10
Copy link
Contributor

s-alves10 commented Jun 5, 2023

Proposal

Updated

@s77rt
I created a EMOJI_SPLITTER in CONST.js and used it in getTextMatrix function. I think the current logic is robust. Please check

@s77rt
Copy link
Contributor

s77rt commented Jun 5, 2023

@s-alves10 This seems over engineered. Why can't we just split on spaces and emojis? (in one regex)

@s77rt
Copy link
Contributor

s77rt commented Jun 5, 2023

@s-alves10 I don't understand why you are adding the loop, why don't split on spaces and emojis going with something like:

"hi there👌 test: you're".split(/(\s|👌)/)

replacing 👌 with the emoji regex.

@s-alves10
Copy link
Contributor

@s77rt
Oops. I was thinking the hardest way? Thank you for teaching me. Yeah, it works

@s77rt
Copy link
Contributor

s77rt commented Jun 5, 2023

@s-alves10 Awesome. Can you please update your proposal?

@s-alves10
Copy link
Contributor

Proposal

Updated

@s77rt
Copy link
Contributor

s77rt commented Jun 5, 2023

@s-alves10 Thanks. This is looking better. We can work on the rest details in the PR.

🎀 👀 🎀 C+ reviewed

cc @flodnv

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 6, 2023

📣 @s-alves10 You have been assigned to this job by @flodnv!
Please apply to this job in Upwork 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 📖

@flodnv
Copy link
Contributor

flodnv commented Jun 6, 2023

Great! Thanks, go for it @s-alves10 🙇

@s-alves10
Copy link
Contributor

Thank you. I'll have a PR ready for review in a few hours

@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label Jun 6, 2023
@s-alves10
Copy link
Contributor

@s77rt @flodnv

PR is ready for review.

@melvin-bot
Copy link

melvin-bot bot commented Jun 7, 2023

🎯 ⚡️ Woah @s77rt / @s-alves10, great job pushing this forwards! ⚡️

The pull request got merged within 2 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @s-alves10 got assigned: 2023-06-06 15:00:48 Z
  • when the PR got merged: 2023-06-07 21:28:22 UTC

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Jun 12, 2023
@melvin-bot melvin-bot bot changed the title [$1000] IOS - Chat - Top of the emoji inside the inline block is cut off [HOLD for payment 2023-06-19] [$1000] IOS - Chat - Top of the emoji inside the inline block is cut off Jun 12, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 12, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 12, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 12, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.26-4 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-06-19. 🎊

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

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 12, 2023

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:

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

@s77rt s77rt mentioned this issue Jun 13, 2023
5 tasks
@s77rt
Copy link
Contributor

s77rt commented Jun 13, 2023

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 19, 2023
@flaviadefaria
Copy link
Contributor

@s77rt @s-alves10 Issuing payment for you both now for $1000 + $500 (bonus) each.

@flaviadefaria
Copy link
Contributor

Offers sent!

@flaviadefaria
Copy link
Contributor

Payment has been issued so closing this.

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

6 participants