Skip to content

MenuItem decomposition - brick road indicator - #100704

Merged
roryabraham merged 17 commits into
Expensify:mainfrom
software-mansion-labs:war-in/menuitem-decomposition-brick-road-indicator
Sep 15, 2026
Merged

roryabraham merged 17 commits into
Expensify:mainfrom
software-mansion-labs:war-in/menuitem-decomposition-brick-road-indicator

Conversation

@war-in

@war-in war-in commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Adds MenuItem.BrickRoadIndicator — a composable leaf rendering the red/green dot inside MenuItem.Trailing, announcing "your review is required" to screen readers via MenuItemAccessibilityContext. Migrates ~30 accounting/card pages from MenuItemWithTopDescription + brickRoadIndicator prop to MenuItemField + the new child. Adds a comparison story.

Fixed Issues

$ #100312
PROPOSAL:

Tests

  1. Sign in to an account with a Collect/Control workspace.

  2. Go to Workspace > Accounting and connect (or use an already connected) QuickBooks Online policy.

  3. Open Import — verify each row renders label above value, with a chevron on the right.

  4. Force an error on one of the imported settings (e.g. fail a setting update while offline, then go online so errorFields is populated for that setting).

  5. Verify a red dot appears left of the chevron on the affected row, and that the row is still tappable and navigates to the correct page.

  6. Repeat steps 3–5 for Export and Advanced on QuickBooks Online, QuickBooks Desktop, NetSuite, Sage Intacct, Xero, Rillet, Dual Entry and Certinia — verify no row lost its label, value, chevron or dot vs. main.

  7. Turn on VoiceOver (iOS) / TalkBack (Android) and focus a row that shows the dot — verify the row announces the label, the value, and "your review is required".

  8. Go to Settings > Wallet and open a personal card's details.

  9. Tap Card name, submit a name change that fails (or fails while offline), and return to the details page.

  10. Verify a red dot appears on the Card name row left of the chevron, and that the same holds for Transaction start date when scrapeMinDate is in error.

  11. Open Workspace > Company cards, select a card, and open its details page.

  12. Verify rows with settings in error show the red dot, rows without it show only the chevron, and every row navigates as before.

Offline tests

  1. Go offline.
  2. Go to Workspace > Accounting > Import on a connected policy and change a setting.
  3. Verify the row shows the greyed-out (pending) style and no brick road dot.
  4. Go back online and let the request fail.
  5. Verify the red dot appears on that row once errorFields is set, and clears after a successful retry.

QA Steps

Same as tests.

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • 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.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

@codecov

codecov Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

@war-in

war-in commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

@codex review
@MelvinBot review
@claude review

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 Reviewed the full diff (44 files). No blocking bugs found. The new MenuItem.BrickRoadIndicator leaf is correct and the ~40 page migrations preserve behavior. Four things worth addressing before merge, none of them severe.

1. shouldParseHelperText was silently dropped

NetSuiteTravelBillingConfigurationPage.tsx:97-102

main passed shouldParseHelperText, which routed the copy through Parser.replace + RenderHTML. The replacement FormHelpMessage omits shouldRenderMessageAsHTML, so it renders as plain <Text>. All 10 locales of travelDescription are currently plain prose, so nothing breaks today — but the moment marketing adds a link or bold to that string it leaks as literal markup. Pass shouldRenderMessageAsHTML to keep parity.

2. interactive / shouldShowRightIcon are now dead keys, and the guard is inconsistent

Both files stopped reading interactive/shouldShowRightIcon but left them on the object literals. It happens to be correct because those rows also have no onPress — MenuItemField derives both interactivity and the chevron from onPress alone. But the invariant is now implicit: add an onPress to the "Export Expensify Card" row and it silently becomes tappable with a chevron.

Xero kept an explicit menuItem?.interactive === false ? undefined : menuItem?.onPress guard (DynamicXeroExportConfigurationPage.tsx:155). Pick one: either delete the dead keys in QBD/QBO, or apply Xero's guard everywhere.

3. Inconsistent import of the new leaf

NetSuiteExportConfigurationPage.tsx:2 reaches into @components/MenuItem/leaves/trailing/icons/MenuItemBrickRoadIndicator directly. Every other one of the ~40 migrated files uses MenuItem.BrickRoadIndicator. Worth aligning so the compound API stays the single entry point.

4. Missing test for the PR's stated contract

MenuItemBrickRoadIndicatorTest.tsx covers rendering, both colors, and the announcement lifecycle — good coverage. But the component's own doc comment says "render it before MenuItem.Chevron so it reads left of the navigation arrow", and no test asserts that ordering on an interactive row. A MenuItemField with onPress + the dot, checking dot-before-chevron, would lock in the thing the whole PR is about.

What I verified as correct (no action needed)
  • Conditional rendering. MenuItemField gates the trailing cell on (!!children || !!onPress). Every migration passes the dot as {cond && <BrickRoadIndicator/>}, and areSettingsInErrorFields / areCardsCustomExportInErrorFields both return real booleans (PolicyUtils.ts:2138, CardFeedUtils.ts:592) — so no 0 or '' leaks into the tree.
  • Dot ordering and styling. {children} renders before <MenuItemChevron /> in the preset. The Icon has no explicit size in either the old or new code, so both render at iconSizeNormal. theme.danger / theme.success mapping is unchanged.
  • interactive → onPress conversions. Checked all of them: Certinia, Xero, FieldsValueSettingsPage, DynamicWorkspaceCompanyCardDetailsPage, and the onPress={() => {}} interactive={false} rows in DualEntry/Rillet all land on the same interactivity and the same chevron visibility as main.
  • callFunctionIfActionIsAllowed. Legacy MenuItem defaults shouldCheckActionAllowedOnPress = true; MenuItemField and MenuItemAction wrap unconditionally. Same anonymous-user behavior.
  • Table.tsx pressableTestID → testID. MenuItemRoot puts testID on the PressableWithFeedback, so CONST.SELECTION_LIST_WITH_MODAL_TEST_ID still lands on the pressable, not a wrapper view.
  • Helper-text typography. mutedNormalTextLabel and formHelp resolve to identical fontSize/lineHeight (fontScale.label === variables.fontSizeLabel, lineHeightScale.label === variables.lineHeightNormal), and formHelp's marginBottom: 4 is overridden by the styles.mb0 that FormHelpMessage already applies. No visual drift.
  • Title truncation. BaseMenuItemPrimaryText hardcodes numberOfLines={1}, matching legacy's numberOfLinesTitle = 1 default.
  • name={item.description ?? ''}. Every section object in the Sage Intacct and NetSuite export pages always supplies description; the ?? '' only satisfies the optional prop on the shared type. No empty label renders in practice.
  • Leftover MenuItemWithTopDescription imports. All 8 files that kept the import still have at least one usage.
  • CI. Everything green except Check independent approval, which is the usual review-gate check, not a code failure.
Smaller things you may want to sanity-check on device

Rows whose value can be empty now collapse to the MenuItemFieldNamePlaceholder style instead of showing the small top label over a blank line. This hits transactionStartDate on DynamicWorkspaceCompanyCardDetailsPage.tsx:270 (value is '' when scrapeMinDate is unset) and the card-name row in PersonalCardDetailsHeaderMenu. I read this as the intended preset behavior rather than a regression, but it is a visible difference from main and isn't in the screenshots.

Trailing spacing also shifts slightly: legacy wrapped the dot in ml1 + mr2, the new MenuItemTrailing uses a uniform gap2. Expected as part of the design-system unification.


Next Steps: Reply with @MelvinBot <your feedback> to dig into any of these.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: f718f1e442

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@war-in

war-in commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

@Pujan92 all AI comments resolved, PR is all yours 😄

@war-in
war-in marked this pull request as ready for review September 10, 2026 14:11
@war-in
war-in requested review from a team as code owners September 10, 2026 14:11
@melvin-bot
melvin-bot Bot requested review from Pujan92 and flaviadefaria and removed request for a team September 10, 2026 14:11
@melvin-bot

melvin-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

@Pujan92 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d036fe760e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@Pujan92

Pujan92 commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • 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.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-09-11.at.20.10.11.mov
Screen.Recording.2026-09-11.at.20.09.38.mov
Screenshot 2026-09-11 at 20 05 22

@war-in

war-in commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

@Pujan92 review addressed 😄

…icator

# Conflicts:
#	src/pages/workspace/accounting/netsuite/export/DynamicNetSuiteInvoiceItemPreferenceSelectPage.tsx
@war-in

war-in commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

The TS error is unrelated

@Pujan92 Pujan92 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@melvin-bot
melvin-bot Bot requested a review from roryabraham September 11, 2026 19:54
@roryabraham
roryabraham merged commit 6882094 into Expensify:main Sep 15, 2026
34 of 35 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🚧 roryabraham has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/roryabraham in version: 9.4.80-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 No help site changes are required for this PR. I did not create a docs PR.

This is an internal component refactor with no user-visible change. The red/green dot renders in the same place, in the same colors, on the same rows as before — only the code that produces it moved.

What I checked

The change is structural, not behavioral. The diff is a prop rename across ~30 accounting and card pages — description → name and title → value — as those pages move from MenuItemWithTopDescription + the brickRoadIndicator prop to MenuItemField + the new MenuItem.BrickRoadIndicator child. No row gains, loses, or relocates a dot.

The new component preserves the existing semantics. src/components/MenuItem/leaves/trailing/icons/MenuItemBrickRoadIndicator.tsx:38-41 still renders DotIndicator filled with theme.danger for ERROR and theme.success otherwise, positioned left of the chevron.

No copy changed. No src/languages/*.ts file is touched in the diff. The one new string usage, common.yourReviewIsRequired, is an existing key reused for a screen-reader announcement.

The articles that mention the dot stay accurate. I searched App/docs/articles for red dot, green dot, brick road, and review-required wording. The matches — for example Fix a Broken Company Card Feed Connection and Connect to QuickBooks Online — describe a red dot meaning a connection or setting needs attention. That is still exactly what users see. The help site does not document screen-reader announcements, so the new accessibility behavior needs no article either.

war-in — since there are no docs updates to make, there is no help site PR to review or mark Ready for review. If you expected a specific article to change, tell me which flow you have in mind and I'll take another look.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/luacmartins in version: 9.4.80-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 failure ❌

Bundle Size Analysis (Sentry):

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants