fix(ui-react): migrate raw overlay wrappers to BaseDialog and ConfirmDialog#6381
Conversation
ac6720f to
e4e7373
Compare
4260fbe to
251ffb2
Compare
e4e7373 to
3a67dbd
Compare
453cc9c to
d3ec964
Compare
Five components were implementing dialogs with `fixed inset-0` div
wrappers instead of using the shared BaseDialog/ConfirmDialog primitives.
This meant no focus trap, no native ESC handling, and no backdrop-click
semantics — each component reinvented the wheel differently.
Migrate:
- MfaDisableDialog → BaseDialog (size="sm")
- MfaRecoveryCodesModal → BaseDialog (size="md")
- MfaRecoveryTimeoutModal → BaseDialog (canClose={() => false}) to block
both ESC and backdrop click — user must use the explicit Close button
- Profile (DeleteAccountWarningDialog) → BaseDialog (size="md")
- SessionDetails (Delete Recording, Close Session) → ConfirmDialog with
per-dialog error state so errors are cleared on re-open
Update tests:
- Add HTMLDialogElement.showModal/close stubs to global test/setup.ts
so all BaseDialog-using components work under jsdom
- Mock useFocusTrap in MfaDisableDialog, MfaRecoveryTimeoutModal, and
MfaRecover test files
- Replace old DOM-traversal backdrop tests (`.relative`/previousSibling)
with fireEvent on the native <dialog> element
d3ec964 to
c601ea6
Compare
|
/review |
|
Claude finished @gustavosbarreto's task in 7m 2s —— View job Code Review CompleteReviewed 21 files across code quality, security, testing, TypeScript/React patterns, and architecture — no issues found. The code looks good as-is. The migration is consistent and well-executed: all five components follow the same pattern (replace If you push additional changes and want a new review, tag |
Summary
fixed inset-0div wrappers — no focus trap, no native ESC handling, no consistent backdrop-click semanticsMfaDisableDialog→BaseDialog(size="sm")MfaRecoveryCodesModal→BaseDialog(size="md")MfaRecoveryTimeoutModal→BaseDialogwithcanClose={() => false}— blocks both ESC and backdrop click, user must use the explicit Close buttonProfile(DeleteAccountWarningDialog) →BaseDialog(size="md")SessionDetails(Delete Recording + Close Session) →ConfirmDialogwith per-dialog error state that clears on re-openHTMLDialogElement.showModal/closestubs to globalsrc/test/setup.tsso all BaseDialog-using components work under jsdomvi.mock("@/hooks/useFocusTrap", ...)toMfaDisableDialog,MfaRecoveryTimeoutModal, andMfaRecovertest files.relative/previousElementSibling) withfireEventon the native<dialog>elementTest plan
npx vitest run— all 1904 tests pass