Skip to content

[Due for payment 2026-10-14] [$175] Web - Search Preview - Angle brackets "<>" enclosed in backticks fail to display #102388

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: v9.4.94-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/75704622/folder/13176964/104980768/1798307405?sort=%2Bidentifier
Email or phone of affected tester (no customers): leungbratt6+27096@gmail.com
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Windows 10/Chrome
App Component: Search

Action Performed:

  1. Open the New Dot app
  2. Create a new group chat via FAB (+) > Start Chat
  3. Set the group name as < > and create the group
  4. Click on the Search button
  5. Click on the Search in suggestion below

Expected Result:

Verify the search preview label shows < >

Actual Result:

The Search in suggestion preview only shows the backticks ``

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7270539_1790489304064.backtick.mp4
Image

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7270539

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    Daily
    Bug
    on Sep 28, 2026
  2. MelvinBot commented on Sep 28, 2026

    @MelvinBot
    Contributor

    Proposal

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

    The "Search in" suggestion drops < > from a group chat name. A group named `< >` shows as "Search in ``".

    What is the root cause of that problem?

    The "Search in" label runs the report name through Parser.htmlToText whenever the report has no parent action (SearchRouter.tsx:231). A group chat has no parent action, so undefined !== ADD_COMMENT is true. htmlToText then treats < > as an HTML tag and deletes it (SearchRouter.tsx:285-291).

    The "Recent chats" list in the same popover shows the name correctly. It already guards with !!reportAction && (SearchAutocompleteList.tsx:532). Fix search preview stripping of some special characters from user-typed messages when characters are misinterpreted as html added that guard but didn't update SearchRouter.tsx.

    Supporting evidence
    • The header, the left-hand list and "Recent chats" all show `< >`, so the stored name is raw. It is not HTML-encoded or decoded twice.
    • ExpensiMark's stripTag rule is /(<([^>]+)>)/gi → '', and < > matches it.
    • The label renders as plain text through SearchQueryListItem → TextWithTooltip. No HTML renderer is involved.
    • Follow up moved this report chat shown as html tag in search & member section added the check. It meant to parse only system-message threads, such as "moved this expense", but its check also matches every report with no parent action.

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

    1. In SearchRouter.tsx, add the same !!reportAction && guard that SearchAutocompleteList.tsx uses. Only threads whose parent action is not a user comment will be parsed.
    2. Look up reportAction from contextualReport directly. Today it comes from reportForContextualSearchReport, which is undefined when the report isn't in recent reports. Without this change, the new guard would leave raw HTML for system-message threads that aren't in recent reports.
    3. Apply the same guard in DynamicRoomMembersPage.tsx:75. It has the same unguarded check, so the Members page subtitle likely drops < > too. I haven't tested this.
    4. Add tests modeled on the "should (not) call Parser.htmlToText" cases in tests/ui/components/SearchAutocompleteListTest.tsx.

    What alternative solutions did you explore? (Optional)

    Pull the check into one shared helper, for example shouldParseReportNameAsHTML(report), and call it from all three places so they can't drift apart again.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/102388) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  3. added
    External
    on Sep 28, 2026
  4. melvin-bot commented on Sep 28, 2026

    @melvin-bot

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

  5. changed the title [-]Web - Search Preview - Angle brackets "<>" enclosed in backticks fail to display[/-] [+][$175] Web - Search Preview - Angle brackets "<>" enclosed in backticks fail to display[/+] on Sep 28, 2026
  6. melvin-bot commented on Sep 28, 2026

    @melvin-bot
  7. naufalfx805-source commented on Sep 28, 2026

    @naufalfx805-source
  8. melvin-bot commented on Sep 28, 2026

    @melvin-bot

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

  9. ashusatyarthi-wq commented on Sep 28, 2026

    @ashusatyarthi-wq

    Proposal

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

    On Web/Desktop, when a user creates or navigates to a group chat whose name contains angle brackets enclosed in backticks (e.g. `< >`) and opens the Search popover, the "Search in" contextual suggestion row renders only the empty backticks ( ), stripping the angle brackets < >. Meanwhile, the "Recent chats" section directly beneath it correctly displays `< >`.

    What is the root cause of that problem?

    In src/components/Search/SearchRouter/SearchRouter.tsx (lines 228–231):

    let reportForContextualSearch = recentReports.find((option) => option.reportID === contextualReportID);
    const reportForContextualSearchReport = reportForContextualSearch ? contextualReport : undefined;
    const reportAction = getReportAction(reportForContextualSearchReport?.parentReportID, reportForContextualSearchReport?.parentReportActionID);
    const shouldParserToHTML = reportAction?.actionName !== CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT;

    There are two distinct bugs here:

    1. Unguarded reportAction check:
      For standard chat reports (such as group chats, 1:1 DMs, or general rooms) that do not originate from a thread parent action, reportAction is undefined. Because reportAction?.actionName evaluates to undefined, the check reportAction?.actionName !== CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT evaluates to true (undefined !== 'ADD_COMMENT').
      This sets shouldParserToHTML = true, causing plain-text group titles to be processed through Parser.htmlToText(...) on lines 287–290:

      text: StringUtils.lineBreaksToSpaces(
          `${translate('search.searchIn')} ${
              shouldParserToHTML
                  ? Parser.htmlToText(reportForContextualSearch.text ?? reportForContextualSearch.alternateText ?? '')
                  : (reportForContextualSearch.text ?? reportForContextualSearch.alternateText ?? '')
          }`,
      ),

      Parser.htmlToText strips any text inside <...>, treating < > as an HTML tag, leaving only the surrounding backticks .

    2. Fragile reportForContextualSearchReport dependency:
      reportForContextualSearchReport is only defined if reportForContextualSearch is found in recentReports. If contextualReport is not in recentReports (e.g., newly navigated report or opened directly via URL), lines 232–255 create reportForContextualSearch from contextualReport, but reportAction was already computed with undefined.

    In contrast, src/components/Search/SearchAutocompleteList.tsx (line 532) already contains the correct guard introduced in PR #82451:

    const shouldParserToHTML = !!reportAction && reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT;

    Furthermore, src/pages/DynamicRoomMembersPage.tsx (line 75) suffers from the exact same unguarded check:

    const shouldParserToHTML = reportAction?.actionName !== CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT;

    which strips < > from room titles in the room members page subtitle.

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

    1. In src/components/Search/SearchRouter/SearchRouter.tsx:
      Look up reportAction directly from contextualReport, and guard shouldParserToHTML with !!reportAction:

      const reportAction = getReportAction(contextualReport?.parentReportID, contextualReport?.parentReportActionID);
      const shouldParserToHTML = !!reportAction && reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT;

      Remove the intermediate reportForContextualSearchReport variable so that reportAction is consistently resolved whether or not contextualReport was already present in recentReports.

    2. In src/pages/DynamicRoomMembersPage.tsx:
      Update line 75 to guard against undefined reportAction:

      const shouldParserToHTML = !!reportAction && reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT;

      (Or alternatively, extract a shared helper shouldParseReportNameAsHTML(reportAction?: ReportAction | null): boolean in src/libs/ReportUtils.ts and use it across SearchRouter.tsx, SearchAutocompleteList.tsx, and DynamicRoomMembersPage.tsx to prevent future drift).

    3. Automated Unit Tests:
      Add test coverage in tests/ui/components/SearchAutocompleteListTest.tsx and/or a new SearchRouter test asserting that for contextual reports without a parent report action whose title contains < >, Parser.htmlToText is not called and angle brackets are preserved verbatim.

    What alternative solutions did you explore? (Optional)

    • Escaping HTML characters via escapeHTML: Inappropriate because the chat title is already raw plain text, not HTML; passing plain text into Parser.htmlToText when there is no HTML parent action is the architectural flaw.

    Contributor details:
    Your Expensify account email: ashusatyarthi@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~010e53044b5828fe60

  10. franklincg commented on Sep 28, 2026

    @franklincg

    Proposal

    Root causeThe recent-chats path already handles this correctly by checking that a parent action exists before applying HTML-to-text ### Validation

    Add a test for a normal group chat name containing angle brackets and verify the contextual Search in suggestion preserves the complete name. Also keep coverage for action-backed labels so the existing parser behavior does not regress.conversion.

    Fix

    Mirror that logic in SearchRouter and resolve the parent action from the contextual report itself so newly opened reports behave the same way.

    The contextual Search in suggestion in SearchRouter.tsx runs the room label through Parser.htmlToText when the resolved parent action is not ADD_COMMENT. For a normal group chat there is no parent action, so the condition is still true and plain text is incorrectly treated as HTML.

  11. 20 remaining items

  12. ashusatyarthi-wq commented on Oct 8, 2026

    @ashusatyarthi-wq

    Hi @DylanDylann @Gonals,

    Since @naufalfx805-source withdrew their proposal, my earlier proposal (#5870054251) was the first valid human proposal that identified this exact root cause and fix implemented in PR #102840.

    Could you please assign and hire me for the contributor bounty before the payment milestone on October 14? My contributor details and Upwork profile are already on file. Thank you!

  13. added
    Daily
    Awaiting Payment
    and removed
    Weekly
    on Oct 13, 2026
  14. melvin-bot commented on Oct 13, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  15. melvin-bot commented on Oct 13, 2026

    @melvin-bot

    Payment Summary

    Resolving PRs:

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  16. melvin-bot commented on Oct 16, 2026

    @melvin-bot

    @mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

  17. mallenexpensify commented on Oct 16, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @DylanDylann due $175 via NewDot

  18. quinthar commented on Oct 27, 2026

    @quinthar
    Contributor

    Approved $175 to @DylanDylann

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions