Skip to content

[MPDX-9541] - Hide Back button on first step of PDS Goal Calculator#1767

Merged
wjames111 merged 4 commits into
mainfrom
MPDX-9541
May 12, 2026
Merged

[MPDX-9541] - Hide Back button on first step of PDS Goal Calculator#1767
wjames111 merged 4 commits into
mainfrom
MPDX-9541

Conversation

@wjames111
Copy link
Copy Markdown
Contributor

@wjames111 wjames111 commented May 8, 2026

Description

Testing

  • Go to HR Tools → PDS Goal Calculator
  • On the first step ("Calculator Setup"), confirm the Back button is not visible
  • Fill in required fields and click Continue
  • On the next step, confirm the Back button is visible
  • Click Back and confirm you return to "Calculator Setup" (Back button hides again)

Checklist:

  • I have given my PR a title with the format "MPDX-(JIRA#) (summary sentence max 80 chars)"
  • I have applied the appropriate labels (Add the label "Preview" to automatically create a preview environment)
  • I have run the Claude Code /pr-review command locally and fixed any relevant suggestions
  • I have requested a review from another person on the project
  • I have tested my changes in preview or in staging
  • I have cleaned up my commit history

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Bundle sizes [mpdx-react]

Compared against 9e1a327

No significant changes found

@wjames111 wjames111 self-assigned this May 8, 2026
@wjames111 wjames111 added On Staging Will be merged to the staging branch by Github Actions Preview Environment Add this label to create an Amplify Preview labels May 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Preview branch generated at https://MPDX-9541.d3dytjb8adxkk5.amplifyapp.com

Copy link
Copy Markdown
Contributor Author

@wjames111 wjames111 left a comment

Choose a reason for hiding this comment

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

Multi-Agent Code Review — APPROVED WITH SUGGESTIONS

Risk: LOW (3/10) · Mode: Standard · Agents: Architecture, Testing, Standards, UX

The stated goal — hide Back on the first step of the PDS Goal Calculator — is implemented correctly via showBackButton={!isFirstStep}. No blockers. Three medium-priority concerns and two suggestions are inline below; the layout-shift concern (M1) is the most important to confirm with design before merge.

Medium Priority Findings (inline)

  • M1 — DirectionButtons layout shift affects MHA & ASR consumers, not just PDS (UX + Architecture, 6.5)
  • M2 — Dead justifyContent conditional and unconditionally-rendered empty Box (Architecture, 6.5)
  • M3 — No structural test coverage for the DirectionButtons re-layout (Testing + Architecture, 6.5)

Suggestions (inline)

  • S1 — Add an isLastStep edge-case test (Testing, 4.0)
  • S2 — Align name: 'Back' query with the file's /regex/i convention (Testing, 3.0)

Out-of-Scope Suggestion (no inline anchor)

  • S3 — Migrate inline <ChevronLeft />/<ChevronRight /> Button children to MUI startIcon/endIcon (UX, 3.5). Matches the pattern in SalaryCalculator/StepNavigation/StepNavigation.tsx and auto-marks the icons decorative for screen readers. Worth a follow-up ticket; out of scope here.

Working-Tree Note (NOT a PR finding — informational)

A local unstaged edit on src/components/HrTools/PdsGoalCalculator/PdsGoalCalculator.test.tsx:107 changes the line in this PR from

await findByRole('button', { name: /continue/i });

to

await findByRole('button', { name: /continue/i }).toBeInTheDocument();

The second form is broken — findByRole returns Promise<HTMLElement>, and Promise has no .toBeInTheDocument method, so this throws at runtime. The line in the actual PR diff is correct; please discard the local edit before your next commit:

git checkout -- src/components/HrTools/PdsGoalCalculator/PdsGoalCalculator.test.tsx

Review generated by /quality:agent-review. Reply /dismiss: <reason> to any inline finding (severity < 7) you want to acknowledge and exclude from the verdict.

)}
</Box>

<Box sx={{ display: 'flex', gap: 2 }}>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[Medium] **Layout shift affects MHA & ASR, not just PDS.**

Wrapping Discard + Back into a single left-side flex Box (and Continue/Submit into this new right-side Box) is silently visible to every existing caller that passes both handleDiscard and showBackButton:

  • MinisterHousingAllowance/Steps/StepTwo/RentOwn.tsx — Discard + Back + Continue
  • MinisterHousingAllowance/Steps/StepThree/Calculation.tsx — Discard + Back + Submit
  • AdditionalSalaryRequest/RequestPage/RequestPage.tsx — middle pages with editable request

Old layout: Discard at far-left, Back+Continue grouped on the right.
New layout: Discard+Back grouped on the left, Continue/Submit alone on the right.

The prior commit 7df16b9c8 Fix styling on back/continue buttons suggests the change is intentional, but the PR title only references PDS. Recommend confirming with design that the new MHA Step 2 / Step 3 / ASR middle-page arrangement is intended, or grabbing before/after screenshots for QA.

Flagged by Architecture + UX agents.

@@ -101,16 +101,15 @@ export const DirectionButtons: React.FC<DirectionButtonsProps> = ({
: 'space-between',
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[Medium] **Dead `justifyContent` conditional and unconditionally-rendered empty Box.**

With the new structure, the outer container always has two child Boxes. The ternary !handleDiscard && !showBackButton && !isSubmission ? 'flex-end' : 'space-between' only triggers flex-end when the left Box is empty (0-width), so flex-end and space-between are visually identical in that case. The conditional is dead, and the empty Box is rendered even when neither Discard nor Back is present.

Suggested cleanup:

<Box sx={{ mt: 5, display: 'flex', justifyContent: 'space-between' }}>
  {(handleDiscard || showBackButton) && (
    <Box sx={{ display: 'flex', gap: 2 }}>
      {handleDiscard && (...)}
      {showBackButton && (...)}
    </Box>
  )}
  <Box sx={{ display: 'flex', gap: 2 }}>{/* Continue / Submit */}</Box>
</Box>

With only the right Box present, space-between and flex-end produce the same single-child result.

Flagged by Architecture agent.

</Button>
)}

<Box sx={{ display: 'flex', gap: 2 }}>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[Medium] **No structural test coverage for the layout re-grouping.**

DirectionButtons.test.tsx exists and continues to pass (its assertions are role-based, so the structural change doesn't break them). But there's no test asserting that the new (Discard | Back | Continue/Submit) layout renders as expected — especially the !handleDiscard && !showBackButton && !isSubmission case, where the left Box is now empty.

Adding a structural assertion in DirectionButtons.test.tsx would protect every consumer (MHA, ASR, PDS) against future regressions in the flex shape.

Flagged by Testing + Architecture agents.

formTitle={currentStep.title}
handleNextStep={handleContinue}
handlePreviousStep={handlePreviousStep}
showBackButton={!isFirstStep}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[Suggestion] **Add an `isLastStep` edge-case test.**

MainContent wraps DirectionButtons in {!isLastStep && (...)}, so on the last step the entire row disappears. The new tests cover step 0 (Back hidden) and step 1 (Back shown) but not the SummaryReport (last) step.

Not strictly required for this PR, but a 'hides the entire DirectionButtons row on the last step' test would round out the multi-step nav coverage.

Flagged by Testing agent.

);

await findByRole('button', { name: /continue/i });
expect(queryByRole('button', { name: 'Back' })).not.toBeInTheDocument();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[Suggestion] **Align query convention with the rest of this file.**

The rest of this test file uses regex matchers (name: /continue/i) but the three new tests use exact match (name: 'Back'). I verified there's no Back to ... collision in PdsGoalCalculator/**, so the exact match is safe — but name: /back/i would be consistent with the file-local convention.

Flagged by Testing agent.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

AI Review Auto-Approval

Risk Level: LOW (3/10)
Verdict: APPROVED_WITH_SUGGESTIONS (suggestions posted, no blockers)

This PR was auto-approved because:

  • The multi-agent AI review determined it is low risk
  • No blocking issues were found
  • All suggestions have been posted as review comments for the developer to consider

If you believe this PR needs human review, dismiss this approval and request a review manually.

Base automatically changed from MPDX-9475 to main May 12, 2026 19:40
wjames111 and others added 4 commits May 12, 2026 15:47
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The 4-space to 2-space indentation change was unintentional and
created noise in the PR. Restoring locales to match MPDX-9475.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@wjames111 wjames111 merged commit 6bac042 into main May 12, 2026
22 of 24 checks passed
@wjames111 wjames111 deleted the MPDX-9541 branch May 12, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

On Staging Will be merged to the staging branch by Github Actions Preview Environment Add this label to create an Amplify Preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant