Repository navigation
Focus Address line 1 when the home address link opens private personal details - #100315
Conversation
…rsonal details Co-authored-by: Alberto Gonzalez-Cela <Gonals@users.noreply.github.com>
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
…ed group Co-authored-by: Alberto Gonzalez-Cela <Gonals@users.noreply.github.com>
|
Two checks were failing for two unrelated reasons. I pushed a fix for the one that belongs to this PR and left the other alone, because it is already broken on Fixed:
|
| Check | Result |
|---|---|
npm run fmt |
✅ no files rewritten |
npx eslint src/pages/inbox/report/actionContents/HomeAddressRequiredContent.tsx |
✅ pass |
npm test -- --silent tests/unit/HomeAddressRequiredContentTest.tsx |
✅ 3 passed |
npm run react-compiler-compliance-check check src/pages/inbox/report/actionContents/HomeAddressRequiredContent.tsx |
✅ pass |
npm run typecheck |
❌ same 3 pre-existing main errors, nothing new |
npm run lint-changed could not run here — it needs a git merge-base against origin/main, which the shallow CI clone does not have. I ran eslint on the changed file directly instead.
|
🤖 Android test steps verification results: The documented steps could not be run end-to-end: the setup requires
To fully verify the documented steps on Android, grant the |
|
Everything still red is one pre-existing bug on The two remaining failures are the same root cause
This PR does not touch that file —
Why `main` brokeA semantic merge conflict, not a bad merge. Commit I did not merge |
|
No code fix to push — every automated check passes. The two remaining failures are human gates, not code problems.
Everything else is green on the latest commit, including all 8 Jest shards, Two things in the PR body still need you before the checklist can pass:
I deliberately left both alone. Filling in test steps or checking attestation boxes on your behalf would make the checklist assert verification that never happened. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e2f484be8d
ℹ️ 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".
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Good for product.
|
Quick bump, @iwiznia |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppN/a iOS: HybridAppN/a iOS: mWeb SafariN/A MacOS: Chrome / SafariScreen.Recording.2026-09-18.at.11.34.15.AM.mov |
| // The backend links to the private personal details page without a field to focus, so point the link at | ||
| // Address line 1 | ||
| const messageHtml = (getReportActionHtml(action) || getReportActionText(action)).replaceAll( | ||
| ROUTES.SETTINGS_PRIVATE_PERSONAL_DETAILS.route, |
There was a problem hiding this comment.
@MelvinBot shouldn't we have a link based on the environment here? ${environmentURL}/$
There was a problem hiding this comment.
Not for the focus param itself — but yes, this HTML does need the environment treatment, and right now it doesn't get it.
Why the replaceAll doesn't need environmentURL: it replaces only the path substring, so whatever origin the backend baked in is left intact — HomeAddressRequiredContent.tsx:39-41. Prefixing ${environmentURL}/ here would build a second, absolute URL and break the match.
What is missing: the backend bakes https://new.expensify.com into report action HTML, and this component renders it without passing it through adjustExpensifyLinksForEnv (the only caller today is TextCommentFragment.tsx:106). In-app navigation requires the href origin to match the current environment (Link.ts:394, Link.ts:435-437), so on dev/staging the click falls through to openExternalLink and opens production in a new tab — the autofocus never runs where QA tests it.
Suggested change — reuse the existing helper instead of hand-building the URL:
const {adjustExpensifyLinksForEnv} = useEnvironmentActions();
const messageHtml = adjustExpensifyLinksForEnv(getReportActionHtml(action) || getReportActionText(action)).replaceAll(
ROUTES.SETTINGS_PRIVATE_PERSONAL_DETAILS.route,
ROUTES.SETTINGS_PRIVATE_PERSONAL_DETAILS.getRoute(INPUT_IDS.ADDRESS_LINE_1),
);Supporting detail
adjustExpensifyLinksForEnvrewrites only the origin and handles all three href quoting styles; it exists precisely because staging and production share one report-action table, so the stored origin is wrong for one of them — see the doc comment atEnvironmentContextProvider/index.tsx:31-43.- Order doesn't matter: the origin rewrite keys off the origin prefix, the focus rewrite off the path, so the two passes don't interfere.
- The
?fieldToFocus=param does survive internal navigation —getPathFromURLkeepssearch(Url.ts:18-27) — and is read atPrivatePersonalDetailsPage.tsx:54. - Unrelated nit on the same line:
replaceAllon the bare path also matches the longer routesettings/profile/private-personal-details/confirm, producing...private-personal-details?fieldToFocus=addressLine1/confirm. Harmless today since the backend doesn't link there, but anchoring the match to the end of the path would make it safe.
There was a problem hiding this comment.
@MelvinBot any reason we shouldn't? can you apply the change if none?
There was a problem hiding this comment.
No reason not to — it's a two-line change and it can't regress production, since adjustExpensifyLinksForEnv returns the HTML untouched when the current environment already is production.
+import {useEnvironmentActions} from '@components/EnvironmentContextProvider';
function HomeAddressRequiredContent({action}: HomeAddressRequiredContentProps) {
const {translate} = useLocalize();
+ const {adjustExpensifyLinksForEnv} = useEnvironmentActions();
- const messageHtml = (getReportActionHtml(action) || getReportActionText(action)).replaceAll(
+ const messageHtml = adjustExpensifyLinksForEnv(getReportActionHtml(action) || getReportActionText(action)).replaceAll(
ROUTES.SETTINGS_PRIVATE_PERSONAL_DETAILS.route,
ROUTES.SETTINGS_PRIVATE_PERSONAL_DETAILS.getRoute(INPUT_IDS.ADDRESS_LINE_1),
);I checked the things that could have been a reason to skip it, and none of them are:
- Existing tests keep passing.
HomeAddressRequiredContentTest.tsxrenders the component without anEnvironmentProvider, souseEnvironmentActions()resolves to the default context whose implementation is the identity function (default.ts:13) and the existingnew.expensify.comassertions are unchanged. - Order of the two rewrites doesn't matter. The env pass keys off the origin prefix, the focus pass off the path, so they don't interfere.
- No duplication concern. It reuses the existing helper rather than adding a second href-rewriting mechanism, which is what the earlier
CONSISTENCY-3comment on this thread was about.
One caveat on scope: this is a pre-existing bug, not one this PR introduced — the link has always pointed at production outside production. Folding it in here is only worth it because the PR's whole point (autofocus) is untestable on dev/staging without it.
I can only make code changes when directed by the PR author, an assignee, or an existing co-author. Gonals — want me to apply this?
There was a problem hiding this comment.
yeah an issue only on dev and staging, it's fine if we leave it like this too
cc @Gonals
|
@MelvinBot what's the reason it opens the link in a browser on native instead of just navigating to the page |
|
Because in-app navigation is gated on the link's origin matching the build you're running, and the stored href is always the production origin. That check fails on an ad-hoc/staging/dev native build, so the link is treated as an external URL — and on native "external" means It isn't native-specific logic. The same branch runs on web, but there "external" is just a new tab, so it looks much less wrong. The chain:
Why your native build trips it: ad-hoc builds resolve to the staging URL ( Applying On the origin check itselfThe gate is old (it predates the 2023 TS migration, so blame only shows refactor commits) and carries no comment explaining the choice, so I can't quote a documented rationale. Mechanically it means the app treats a link pointing at a different deployment as external rather than following it in-app — which is reasonable, since navigating a production link inside a staging build would render that route against staging data. One native detail worth knowing: if |
|
Oh ok it's the same issue as #100315 (comment) |
|
All yours @iwiznia |
|
🚧 iwiznia has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/iwiznia in version: 9.5.4-0 🚀
|
|
No help site update needed. This PR only auto-focuses the Address line 1 field when the home address link is opened, a small UX fix that doesn't change any step or sentence in an existing help article. |
|
Deploy Blocker #103266 was identified to be related to this PR. |
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.5.4-3 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Deployed to staging by https://github.com/iwiznia in version: 9.5.5-0 🚀
|
|
No help site update needed. This PR only auto-focuses the Address line 1 field when the home address link is opened, a small UX fix that doesn't make any step or sentence in an existing help article incorrect. |
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.5.5-2 🚀
Bundle Size Analysis (Sentry): |




Explanation of Change
Fixed Issues
$ #100235
PROPOSAL: #100235 (comment)
Tests
Offline tests
None
The change is a pure string rewrite of already-rendered report action HTML, so behavior is unchanged offline.
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari