You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2024-01-09] [$500] Chat - Single line code blocks are not vertically centered #31427
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review
Version Number: 1.4.0-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 Expensify/Expensify Issue URL: Issue reported by: Applause-Internal Team Slack conversation: @
Action Performed:
Pre-requisite: user must be logged in.
Go to any chat.
Send a single line code block (like test)
Expected Result:
The text inside the block should be centered.
Actual Result:
The text is horizontally centered, but not vertically, is closer to the bottom.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
changed the title [-]Chat - Single line code blocks are not vertically centered[/-][+][$500] Chat - Single line code blocks are not vertically centered[/+]on Nov 16, 2023
Please re-state the problem that we are trying to solve in this issue.
The text is horizontally centered, but not vertically, is closer to the bottom.
What is the root cause of that problem?
In here, we set the lineHeight to 18, different from fontSize (which is 13 or 15) because we want to render any emoji inside text fully and vertically centered. But this causes problem for text without emoji, it will not be vertically centered. We can see from the image above a text with emoji and text without emoji
(They are on the same line yet are different chunks, due to the text matrix implementation here)
The text with emoji is rendered following the height of the emoji, so it will be vertically centered, so as the emoji. The text without emoji will follow the height of the text, which is equal to the font size and the text will appear lower.
What changes do you think we should make in order to solve the problem?
In textMatrix, we need to split out the emoji from the text, for emoji chunk, we'll follow current logic, for text-without-emoji chunk, the lineHeight will be set equal to the fontSize, and the text will be vertically centered as usual.
What alternative solutions did you explore? (Optional)
Increase the code word wrapper height in iOS to 22 will also center both the text and emoji. We can do similarly for Android if there's issue there.
Different root cause, but emoji in code in h1 is currently cut, that can be potentially fixed by increasing the lineHeight of text when h1, similar to what we did for font size.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review
Activity
[-]Chat - Single line code blocks are not vertically centered[/-][+][$500] Chat - Single line code blocks are not vertically centered[/+]melvin-bot commentedon Nov 16, 2023
Job added to Upwork: https://www.upwork.com/jobs/~0173268787598947ed
melvin-bot commentedon Nov 16, 2023
Triggered auto assignment to @trjExpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Nov 16, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Nov 16, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia (
External)ZhenjaHorbach commentedon Nov 16, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Chat - Single line code blocks are not vertically centered
What is the root cause of that problem?
The main problem is that we are using the wrong line height Which does not match the font size
As a result, the text moves down.
What changes do you think we should make in order to solve the problem?
App/src/styles/codeStyles/index.ios.ts
Lines 13 to 15 in 69a3358
Especially for iOS we have a separate file where we set the line height
We can reduce this value so that it matches font size
And change this value so that it matches the font size
Some updates:
We can use the result of this function or make a similar function for lineHeight with the same result
App/src/styles/StyleUtils.ts
Lines 642 to 644 in 69a3358
And pass in this style object
App/src/components/HTMLEngineProvider/HTMLRenderers/CodeRenderer.js
Lines 25 to 34 in 69a3358
(And delete from this place(Or at least make these changes specific only to iOS, but I think it will work well on all platforms))
App/src/styles/styles.ts
Line 182 in 69a3358
As a result
What alternative solutions did you explore? (Optional)
NA
tienifr commentedon Nov 16, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
The text is horizontally centered, but not vertically, is closer to the bottom.
What is the root cause of that problem?
In here, we set the

lineHeightto 18, different from fontSize (which is 13 or 15) because we want to render any emoji inside text fully and vertically centered. But this causes problem for text without emoji, it will not be vertically centered. We can see from the image above a text with emoji and text without emoji(They are on the same line yet are different chunks, due to the text matrix implementation here)
The text with emoji is rendered following the height of the emoji, so it will be vertically centered, so as the emoji. The text without emoji will follow the height of the text, which is equal to the font size and the text will appear lower.
What changes do you think we should make in order to solve the problem?
In
textMatrix, we need to split out the emoji from the text, for emoji chunk, we'll follow current logic, for text-without-emoji chunk, thelineHeightwill be set equal to thefontSize, and the text will be vertically centered as usual.What alternative solutions did you explore? (Optional)
Increase the code word wrapper height in iOS to 22 will also center both the text and emoji. We can do similarly for Android if there's issue there.
Different root cause, but emoji in code in h1 is currently cut, that can be potentially fixed by increasing the lineHeight of text when h1, similar to what we did for font size.
Krishna2323 commentedon Nov 16, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Chat - Single line code blocks are not vertically centered
What is the root cause of that problem?
We have increased
lineHeightforcodeTextStylein IOS devices but we forgot to increase theheightfor thecodeWordStyle.App/src/styles/codeStyles/index.ios.ts
Lines 13 to 15 in 69a3358
App/src/styles/codeStyles/index.ios.ts
Lines 8 to 11 in 69a3358
What changes do you think we should make in order to solve the problem?
We need to increase the height of the
codeWordStyle. Increasing it to 20 works well, looks similar to android.Result
IOS after fix:

Android without any changes:

shubham1206agra commentedon Nov 16, 2023
This is dupe of #8132
91 remaining items
melvin-bot commentedon Jan 15, 2024
@robertjchen, @trjExpensify, @NicMendonca, @thesahindia, @tienifr Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
robertjchen commentedon Jan 15, 2024
Awaiting completion of BZ checklist
NicMendonca commentedon Jan 16, 2024
https://expensify.slack.com/archives/C02NK2DQWUX/p1705411384108319
thesahindia commentedon Jan 16, 2024
I couldn't find the responsible PR that caused this.
We can add a test case if we want. Here are the steps -
😁 Hi)NicMendonca commentedon Jan 17, 2024
fab ! thanks!
JmillsExpensify commentedon Jan 22, 2024
@NicMendonca Can you add specific payment amounts to this summary?
NicMendonca commentedon Jan 22, 2024
JmillsExpensify commentedon Jan 22, 2024
$500 approved for @thesahindia based on the comment above.