Skip to content

[$250] Android - Room - Bold+code block markdown pasted in room description is displayed with space above #57229

Closed

Description

@IuliiaHerets

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: V9.1.3-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both
Issue reported by: Applause Internal Team
Device used: Redmi note 10s android 13
App Component: Other

Action Performed:

  1. Launch app in both mweb and android
  2. Tap fab- room
  3. Enter all the details and paste room description as - ********1223333************
  4. Create room
  5. Tap header
  6. Note room description

Expected Result:

Bold+code block markdown pasted in room description must be displayed without space above.

Actual Result:

Bold+code block markdown pasted in room description is displayed with space above in android but not in mweb.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6749785_1740120668901.Screenrecorder-2025-02-21-12-15-25-270.1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021894474220438538083
  • Upwork Job ID: 1894474220438538083
  • Last Price Increase: 2025-03-04
Issue OwnerCurrent Issue Owner: @sobitneupane

Activity

  1. added
    Bug
    Daily
    on Feb 21, 2025
  2. melvin-bot commented on Feb 21, 2025

    @melvin-bot

    Triggered auto assignment to @CortneyOfstad (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. changed the title [-]Room - Markdown pasted is inconsistently displayed in mWeb and Android[/-] [+]Android - Room - Bold+code block markdown pasted in room description is displayed with space above[/+] on Feb 21, 2025
  4. bernhardoj commented on Feb 21, 2025

    @bernhardoj
    Contributor

    Proposal

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

    The room description has extra space above.

    What is the root cause of that problem?

    I can't tell exactly why, but it happens because we are pretending an LTR unicode here to the HTML.

    if (shouldRenderAsHTML) {
    titleToWrap = title ? convertToLTR(title) : '';
    }

    If it's prepended before an HTML tag, the issue happens. In our case, the HTML looks like:

    \u2066<code>********1223333************</code>
    

    The LTR unicode was added to force the text to be LTR.

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

    We can remove the convertToLTR from the HTML content

    const processedTitle = useMemo(() => {
    let titleToWrap = '';
    if (shouldRenderAsHTML) {
    titleToWrap = title ? convertToLTR(title) : '';
    }
    if (shouldParseTitle) {
    titleToWrap = html;
    }
    if (shouldTruncateTitle) {
    titleToWrap = Parser.truncateHTML(`<comment>${titleToWrap}</comment>`, characterLimit, {ellipsis: '...'});
    return titleToWrap;
    }
    return titleToWrap ? `<comment>${titleToWrap}</comment>` : '';
    }, [title, shouldRenderAsHTML, shouldParseTitle, characterLimit, shouldTruncateTitle, html]);

    because we already do it on every text.

    domVisitors={{
    // eslint-disable-next-line no-param-reassign
    onText: (text) => (text.data = convertToLTR(text.data)),
    }}

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

  5. melvin-bot commented on Feb 24, 2025

    @melvin-bot

    @CortneyOfstad Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  6. added
    External
    on Feb 25, 2025
  7. changed the title [-]Android - Room - Bold+code block markdown pasted in room description is displayed with space above[/-] [+][$250] Android - Room - Bold+code block markdown pasted in room description is displayed with space above[/+] on Feb 25, 2025
  8. melvin-bot commented on Feb 25, 2025

    @melvin-bot
  9. added
    Help Wanted
    on Feb 25, 2025
  10. melvin-bot commented on Feb 25, 2025

    @melvin-bot

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

  11. CortneyOfstad commented on Feb 25, 2025

    @CortneyOfstad
    Contributor

    Hey @sobitneupane! We have a proposal here for review, when you have a chance. Thanks!

  12. sobitneupane commented on Feb 28, 2025

    @sobitneupane
    Contributor

    Thanks for the propsoal, @bernhardoj

    convertToLTR was introduced by #17659 PR to resolve this issue.

    Could you please go through the test steps in the PR or the issue and post results here to make sure it doesn't result any regression? (At the moment, I am having some issue while trying to build Android app).

  13. bernhardoj commented on Mar 1, 2025

    @bernhardoj
    Contributor

    MenuItem can render the text as plain text or HTML.

    For the plain text, nothing has changed.

    const renderTitleContent = () => {
    if (title && titleWithTooltips && Array.isArray(titleWithTooltips) && titleWithTooltips.length > 0) {
    return (
    <DisplayNames
    fullTitle={title}
    displayNamesWithTooltips={titleWithTooltips}
    tooltipEnabled
    numberOfLines={1}
    />
    );
    }
    return title ? convertToLTR(title) : '';
    };

    {!shouldRenderAsHTML && !shouldParseTitle && !!title && (
    <Text
    style={combinedTitleTextStyle}
    numberOfLines={numberOfLinesTitle || undefined}
    dataSet={{[CONST.SELECTION_SCRAPER_HIDDEN_ELEMENT]: interactive && disabled}}
    >
    {renderTitleContent()}
    </Text>
    )}

    My proposal suggests removing the convertToLTR for HTML only since we already do it on every text content.

    const processedTitle = useMemo(() => {
    let titleToWrap = '';
    if (shouldRenderAsHTML) {
    titleToWrap = title ? convertToLTR(title) : '';
    }
    if (shouldParseTitle) {
    titleToWrap = html;
    }
    if (shouldTruncateTitle) {
    titleToWrap = Parser.truncateHTML(`<comment>${titleToWrap}</comment>`, characterLimit, {ellipsis: '...'});
    return titleToWrap;
    }
    return titleToWrap ? `<comment>${titleToWrap}</comment>` : '';
    }, [title, shouldRenderAsHTML, shouldParseTitle, characterLimit, shouldTruncateTitle, html]);

    {!!title && (shouldRenderAsHTML || (shouldParseTitle && !!html.length)) && (
    <View style={styles.renderHTMLTitle}>
    <RenderHTML html={processedTitle} />
    </View>
    )}

    domVisitors={{
    // eslint-disable-next-line no-param-reassign
    onText: (text) => (text.data = convertToLTR(text.data)),
    }}

    asdad.mp4
  14. sobitneupane commented on Mar 3, 2025

    @sobitneupane
    Contributor

    @bernhardoj

    Are you still able to reproduce the issue? I was unable to reproduce it on my end.

    Could you please share details about the device/simulator you used to reproduce the issue?

    Image
  15. bernhardoj commented on Mar 4, 2025

    @bernhardoj
    Contributor

    I can't repro anymore too after #56924

  16. melvin-bot commented on Mar 4, 2025

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  17. CortneyOfstad commented on Mar 4, 2025

    @CortneyOfstad
    Contributor

    Going to close since this cannot be consistently reproduced. Thanks!

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

Metadata

Metadata

Labels

BugDailyExternalHelp Wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions