Skip to content

fix: exit edit mode when navigating between tabs in Agreement details#5630

Open
weimiao67 wants to merge 4 commits intomainfrom
OPS-5565/agreement_unsaved_nav_blocking
Open

fix: exit edit mode when navigating between tabs in Agreement details#5630
weimiao67 wants to merge 4 commits intomainfrom
OPS-5565/agreement_unsaved_nav_blocking

Conversation

@weimiao67
Copy link
Copy Markdown
Contributor

What changed

  • On the Agreement detail page, clicking Edit on one tab (Agreement Details or SCs & Budget Lines) and then navigating to another tab previously kept edit mode active on the next tab. This was inconsistent with the CAN detail page, which exits edit mode on tab change.
  • Added a useEffect in Agreement.jsx that watches location.pathname and resets isEditMode to false when the user navigates between tabs — mirroring the pattern in Can.hooks.js.
  • The existing useNavigationBlocker modal still intercepts tab clicks when there are real unsaved changes, so the save/discard/cancel flow is unaffected.

Issue

#5565

How to test

  • On an editable agreement, click Edit on Agreement Details, make no changes, click SCs & Budget Lines tab → Budget Lines renders in view mode
  • Click Edit on SCs & Budget Lines, make no changes, click Agreement Details tab → Agreement Details renders in view mode
  • Click Edit on Agreement Details, modify a field, click another tab → navigation blocker modal appears; Discard exits to view mode on the new tab; Cancel keeps edits on the current tab
  • Navigate directly to /agreements/:id?mode=edit → Agreement Details opens in edit mode

A11y impact

  • No accessibility-impacting changes in this PR
  • Accessibility changes included and validated against WCAG 2.1 AA intent
  • Any temporary suppression includes A11Y-SUPPRESSION metadata (owner, expires, rationale)

Screenshots

If relevant, e.g. for a front-end feature

Definition of Done Checklist

  • OESA: Code refactored for clarity
  • OESA: Dependency rules followed
  • Automated unit tests updated and passed
  • Automated integration tests updated and passed
  • Automated quality tests updated and passed
  • Automated load tests updated and passed
  • Automated a11y tests updated and passed
  • Automated security tests updated and passed
  • 90%+ Code coverage achieved
  • [-] Form validations updated

@weimiao67 weimiao67 self-assigned this May 5, 2026
@weimiao67 weimiao67 marked this pull request as ready for review May 5, 2026 21:36
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.

1 participant