Skip to content

Gate NetSuite invoice-item preference selection behind a Save button (a11y On Input, PR 13) - #99239

Open
MelvinBot wants to merge 1 commit into
mainfrom
claude-a11y-netsuite-invoice-item-save
Open

Gate NetSuite invoice-item preference selection behind a Save button (a11y On Input, PR 13)#99239
MelvinBot wants to merge 1 commit into
mainfrom
claude-a11y-netsuite-invoice-item-save

Conversation

@MelvinBot

Copy link
Copy Markdown
Contributor

Explanation of Change

This addresses a WCAG 3.2.2 "On Input" accessibility violation, part of the batched plan in issue #74834 (PR 13). DynamicNetSuiteInvoiceItemPreferenceSelectPage committed the invoice-item preference and, when CREATE was chosen, navigated back the instant a row was tapped — the layout/context changed without the user explicitly confirming, which is disorienting for screen-reader and low-vision users.

The page now stages the preference in local state and only commits it when the user presses the Save button (via confirmButtonOptions on SelectionList), matching the pattern already shipped in PRs 2–8. The Save button is disabled until the staged selection differs from the persisted value. The entangled reveal branch is preserved:

  • On Save, updateNetSuiteInvoiceItemPreference runs (only when the value actually changed), and goBack() is called only for the CREATE branch — SELECT stays on the page.
  • The invoice-item sub-menu (MenuItemWithTopDescription) reveal remains gated on the persisted config.invoiceItemPreference === SELECT, so the item picker only appears once the SELECT preference is actually committed, keeping the item/preference config consistent.

🤖 Generated by MelvinBot. Checks run locally: lint-changed ✅, typecheck-tsgo ✅. React Compiler compliance check couldn't run in this environment (base-ref resolution); this file already uses grandfathered manual memoization, so CI will validate. Full npm test / storybook smoke deferred to CI.

Fixed Issues

$ #74834
PROPOSAL: #74834 (comment)

Tests

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • Verify that no errors appear in the JS console

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

…(a11y On Input, PR 13)

Co-authored-by: truph01 <truph01@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team August 22, 2026 04:05
@melvin-bot melvin-bot Bot added the Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web label Aug 22, 2026
@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
...DynamicNetSuiteInvoiceItemPreferenceSelectPage.tsx 0.00% <0.00%> (ø)
... and 13 files with indirect coverage changes

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Android testing — blocked before reaching the page under test ⚠️

I couldn't verify the Save-button behavior on Android. The "Invoice item preference" page this PR changes lives under Accounting → NetSuite → Export, which is only reachable once a workspace has a genuinely-authenticated NetSuite connection — and that requires real NetSuite sandbox credentials (Account ID / Token ID / Token Secret) that aren't available to the Melvin test session.

How far I got:

  1. Reached Home via onboarding, opened the auto-created workspace's Accounting tab.
  2. NetSuite is gated behind the Control plan — upgraded the workspace (dev-env upgrade succeeded), which unlocked the NetSuite Connect option.
  3. Walked the 4-step NetSuite setup wizard to the final credentials step.
  4. Entered placeholder credentials (no real sandbox available). The app correctly rejected them: "Can't connect to NetSuite due to an authentication error." The connection row stays "Not synced" and exposes only a More (⋮) menu (Enter credentials / Disconnect) — there's no entry point into the Export/Import config tabs, so the Invoice item preference page cannot be opened.

There's no macro/mock to fake a successful NetSuite connection on the emulator, so I stopped rather than fabricate results.

Workspace Accounting page showing NetSuite connection in 'Not synced' state with an authentication error banner

Verification results:

Check Result
Reach Export → Invoice item preference page ❌ Blocked — NetSuite auth required
Tapping an option stages selection without navigating away ⚠️ Not tested (page unreachable)
Save button disabled/enabled by staged vs saved value ⚠️ Not tested (page unreachable)
Save commits: Create → back, Select → reveals sub-menu ⚠️ Not tested (page unreachable)
No JS console / red-box errors ✅ None observed throughout the session

What's needed to complete this: a test workspace with a real, authenticated NetSuite sandbox connection (or a mock connection path on the emulator). With those credentials in place, the same steps above would reach the page and the four staged-selection/Save checks could be run.

Note: I confirmed the code in DynamicNetSuiteInvoiceItemPreferenceSelectPage.tsx implements the described staging (draftPreference state, confirmButtonOptions.isDisabled = currentPreference === selectedValue, and savePreference navigating back only for CREATE), but I could not exercise it live on-device.


view run

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Web testing — blocked before reaching the page under test ⚠️

I couldn't verify the Save-button behavior on Web, for the same reason as Android. The "Invoice item preference" page this PR changes lives under Accounting → NetSuite → Export, which is only reachable once a workspace has a live, authenticated NetSuite connection — and that requires real NetSuite sandbox credentials (Account ID / Token ID / Token Secret) that aren't available to the Melvin test session.

How far I got:

  1. Reached Home, created a new workspace, enabled the Accounting feature.
  2. NetSuite is gated behind the Control plan — used the dev-env upgrade flow to unlock the NetSuite Connect option.
  3. Stepped through the 4-step NetSuite setup wizard (bundle install → token-based auth → SOAP web services → credentials).
  4. Reached the final step: "Enter your NetSuite credentials" (Account ID / Token ID / Token Secret). This is the real Codat/NetSuite handshake, not a mock — placeholder values won't establish a connection, so the Export config (and the "Invoice item preference" page) can't be opened.

There's no mechanism to fake a connected NetSuite state, so I stopped rather than fabricate results.

NetSuite setup wizard step 4 - Enter your NetSuite credentials form blocking further progress

Verification results:

Check Result
Reach Export → Invoice item preference page ❌ Blocked — live NetSuite connection required
Clicking an option stages selection without navigating away ⚠️ Not tested (page unreachable)
Save button disabled/enabled by staged vs saved value ⚠️ Not tested (page unreachable)
Save commits: Create → back, Select → reveals sub-menu ⚠️ Not tested (page unreachable)
No JS console / red-box errors ✅ None observed during the drive

What's needed to complete this: a test workspace with a real, authenticated NetSuite sandbox connection. With those credentials configured, the same steps above would reach the page and the four staged-selection/Save checks could be run.

Note: the code in DynamicNetSuiteInvoiceItemPreferenceSelectPage.tsx implements the described staging (draftPreference state, confirmButtonOptions.isDisabled = currentPreference === selectedValue, and savePreference navigating back only for CREATE), but I could not exercise it live in the browser.


view run

@truph01

truph01 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot Mark this PR as ready

@MelvinBot
MelvinBot marked this pull request as ready for review August 22, 2026 05:10
@MelvinBot
MelvinBot requested a review from a team as a code owner August 22, 2026 05:10
@melvin-bot
melvin-bot Bot requested review from truph01 and removed request for a team August 22, 2026 05:10
@melvin-bot

melvin-bot Bot commented Aug 22, 2026

Copy link
Copy Markdown

@truph01 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]

@melvin-bot
melvin-bot Bot requested review from joekaufmanexpensify and removed request for a team August 22, 2026 05:10
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Done — this PR is now marked Ready for review


view run

@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: e09afce524

ℹ️ 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".

const selectedValue = Object.values(CONST.NETSUITE_INVOICE_ITEM_PREFERENCE).find((value) => value === config?.invoiceItemPreference) ?? CONST.NETSUITE_INVOICE_ITEM_PREFERENCE.CREATE;

const [draftPreference, setDraftPreference] = useState<ValueOf<typeof CONST.NETSUITE_INVOICE_ITEM_PREFERENCE>>();
const currentPreference = draftPreference ?? selectedValue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Clear the draft when a failed save rolls back

When the preference update fails after optimistically saving SELECT, updateNetSuiteOnyxData restores config.invoiceItemPreference to the old value, but draftPreference remains SELECT and always wins here. The checkmark and focus therefore continue to show SELECT while the title and invoice-item submenu follow the rolled-back CREATE value, leaving the page in a contradictory state; reconcile or clear the draft when the Onyx value rolls back. CLAUDE.mdL82-L87

Useful? React with 👍 / 👎.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Nothing to fix in the code — every automated code check (tests, ESLint, Oxfmt, typecheck, React Compiler, Storybook, unused-styles, knip, build, perf) is passing.

The only two failing checks are review-process gates that require a human, not a code change:

  • PR Reviewer Checklist / checklist — fails with "No PR Reviewer Checklist was found". It clears once a reviewer completes the reviewer checklist on the PR.
  • Check independent approval — fails because the PR doesn't yet have an independent approval. It clears once a qualified reviewer approves.

Both resolve through the normal review flow, so there's no push for me to make here.


view run

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Still nothing to fix here — the state is unchanged since my last comment. All automated code checks pass. The only two failing checks are review-process gates that need a human, not a code change:

  • PR Reviewer Checklist / checklist — clears once a reviewer completes the reviewer checklist.
  • Check independent approval — clears once a qualified reviewer approves.

There's no push I can make to turn these green.


view run

@joekaufmanexpensify joekaufmanexpensify 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.

Good for product.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The only failing check on this PR is PR Reviewer Checklist / checklist (run). Every other check is green (39 passing, 5 skipped).

That check isn't a code or test failure — it's the manual reviewer checklist, which fails until a reviewer completes the checklist items in a review comment. There's nothing to fix in code and nothing to push, so I haven't made any changes.

To clear it, a reviewer needs to copy in and complete the PR Reviewer Checklist. No action is needed on the branch itself.


view run

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

Labels

Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants