📌 Description
Modals are implemented independently across SettlementModal.tsx,
CommitmentCreatedModal.tsx, CommitmentDetailsModal.tsx,
CommitmentEarlyExitModal.tsx, and ExportCommitmentsModal.tsx, each handling
focus and escape differently (or not at all). This inconsistency causes focus-
trap and focus-restoration bugs and duplicated code.
This issue adds a single accessible Dialog primitive (focus trap, escape,
focus restoration, role="dialog", aria-modal, scroll lock) and migrates the
existing modals to it.
🎯 Requirements and Context
- A
Dialog component encapsulating focus trapping, restoration, escape, and
ARIA wiring; respects reduced motion.
- Migrate the listed modals without changing their visible behaviour.
- No regressions to existing modal tests.
- Background scroll lock and inert background while open.
🛠️ Suggested Execution
1. Fork the repo and create a branch
git checkout -b refactor/shared-dialog-primitive
2. Implement changes
- Add
src/components/ui/Dialog.tsx and migrate the modals under
src/components/modals/ and src/components/export/.
- Add
src/components/ui/Dialog.test.tsx covering focus trap, restoration,
escape, ARIA, and scroll lock.
- Add
docs/MODAL_SYSTEM.md documenting the primitive and migration.
- Validate accessibility across all migrated modals.
3. Test and commit
- Run
pnpm test.
- Cover edge cases: nested focusable elements, no focusable child, escape while
an async action runs, restore focus to trigger.
Example commit message
refactor: shared accessible Dialog primitive across modals
✅ Guidelines
- Minimum 95% test coverage on the primitive.
- Clear, reviewer-friendly documentation.
- Timeframe: 96 hours.
🏷️ Labels
type-refactor · type-security · area-frontend · MAYBE REWARDED ·
GRANTFOX OSS · OFFICIAL CAMPAIGN
💬 Community & Support
- Join the CommitLabs contributor Discord to coordinate and get unblocked fast:
https://discord.gg/WV7tdYkJk
- Introduce yourself before starting so we can avoid duplicate work and pair you
with a reviewer. Maintainers triage actively and review fast.
📌 Description
Modals are implemented independently across
SettlementModal.tsx,CommitmentCreatedModal.tsx,CommitmentDetailsModal.tsx,CommitmentEarlyExitModal.tsx, andExportCommitmentsModal.tsx, each handlingfocus and escape differently (or not at all). This inconsistency causes focus-
trap and focus-restoration bugs and duplicated code.
This issue adds a single accessible
Dialogprimitive (focus trap, escape,focus restoration,
role="dialog",aria-modal, scroll lock) and migrates theexisting modals to it.
🎯 Requirements and Context
Dialogcomponent encapsulating focus trapping, restoration, escape, andARIA wiring; respects reduced motion.
🛠️ Suggested Execution
1. Fork the repo and create a branch
2. Implement changes
src/components/ui/Dialog.tsxand migrate the modals undersrc/components/modals/andsrc/components/export/.src/components/ui/Dialog.test.tsxcovering focus trap, restoration,escape, ARIA, and scroll lock.
docs/MODAL_SYSTEM.mddocumenting the primitive and migration.3. Test and commit
pnpm test.an async action runs, restore focus to trigger.
Example commit message
✅ Guidelines
🏷️ Labels
type-refactor·type-security·area-frontend·MAYBE REWARDED·GRANTFOX OSS·OFFICIAL CAMPAIGN💬 Community & Support
https://discord.gg/WV7tdYkJk
with a reviewer. Maintainers triage actively and review fast.