Gate workspace picker selection behind a Save button (a11y On Input, PR 11) - #99236
Gate workspace picker selection behind a Save button (a11y On Input, PR 11)#99236MelvinBot wants to merge 1 commit into
Conversation
…PR 11) Co-authored-by: truph01 <truph01@users.noreply.github.com>
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
🤖 Ran the testing steps on Web (dev NewDot). Result: ✅ pass — tapping a workspace row now stages the selection (highlights it and enables Save) instead of committing and navigating away; the change only commits when Save is pressed. Change workspace on an expense report (
Set default workspace ( Domain group preferred workspace ( No error dialogs/toasts were observed during the flow. EvidenceChange workspace picker open — current workspace checked, Save dimmed/disabledOther workspace row tapped — staged (checked, promoted to top), still on picker, Save now enabledAfter pressing Save — "You moved this report!" confirmation, picker closedReport header now shows the report on the newly selected Workspace 1 |
|
🤖 Ran the testing steps on Android (standalone NewDot, emulator). Result: ✅ pass — tapping a workspace row now stages the selection (highlights it and enables Save) instead of committing and navigating away; the change only commits when Save is pressed. Change workspace on an expense report (
The other two pages in this PR weren't exercised on Android: Set default workspace ( No JS console errors or error toasts observed during the flow. Note: "Change workspace" only appears in the More menu while the report is still Open/Draft, so the flow was exercised against a draft expense. EvidenceChange workspace picker open — current workspace checked, Save disabledOther workspace row tapped — staged (checked), still on picker, Save now enabledAfter pressing Save — "You moved this report!" confirmationReport now on the newly selected Workspace 1 |
|
@MelvinBot Mark this PR as ready |
|
🤖 Done — this PR is now marked Ready for review. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f75446aef0
ℹ️ 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".
| currentUserLogin: session?.email, | ||
| shouldShowPendingDeletePolicy: false, | ||
| selectedPolicyIDs: report.policyID ? [report.policyID] : undefined, | ||
| selectedPolicyIDs: currentSelection ? [currentSelection] : undefined, |
There was a problem hiding this comment.
Keep draft workspace selections in place until Save
When a user selects a workspace that is not already first—particularly while searching—passing the changing currentSelection to useWorkspaceList triggers its default shouldSortSelectedToTop behavior, immediately moving that row to the top before Save. During an active search, SelectionList retains its numeric focused index, so focus can now point to a different workspace and the next Enter press selects that unintended row; the immediate reorder also preserves the input-driven context shift this change is meant to prevent. Set shouldSortSelectedToTop: false here and in the corresponding SetDefaultWorkspacePage call while retaining selectedPolicyIDs for highlighting.
Useful? React with 👍 / 👎.
|
The only failing checks are non-code gates that require human action, not a code fix — there's nothing here I can push a fix for:
Every actual code/build check is green: So no fix is needed — these two checks will clear on their own once the PR gets a reviewer + independent approval. |
|
No change since my last analysis — the only two failing checks ( |








Explanation of Change
This addresses a WCAG 3.2.2 "On Input" accessibility violation, part of the batched plan in issue #74834 (PR 11). Three workspace-picker pages committed the selection (and navigated away) the instant a row was tapped, so the layout/context changed without the user explicitly confirming — disorienting for screen-reader and low-vision users.
All three pages now stage the tapped workspace in local state and only commit it when the user presses the Save button (via
confirmButtonOptionsonSelectionList), matching the pattern already shipped in PRs 3–8. The staged row is highlighted viaselectedPolicyIDs, and the Save button is disabled until the staged selection differs from the current value:DomainGroupPreferredWorkspacePage— plain preferred-workspace write, committed on Save.SetDefaultWorkspacePage— theareCategoriesEnabledbranch (navigate onward vs.goBack) and thenavigateToguard are preserved by having Save call the existingselectPolicy.DynamicReportChangeWorkspacePage— the billingRESTRICTED_ACTIONearly-return, the commuter-exclusion distance guard, and the per-report-type API calls (moveIOUReportToPolicy…/changeReportPolicyAndInviteSubmitter/changeReportPolicy) are all preserved by having Save call the existingselectPolicy.🤖 Generated by MelvinBot. Checks run locally:
lint-changed✅,typecheck-tsgo✅. React Compiler compliance check couldn't run in this environment (base-ref resolution); no manual memoization was added, so CI will validate. Fullnpm test/ storybook smoke deferred to CI.Fixed Issues
$ #74834
PROPOSAL: #74834 (comment)
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
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