ENG-181: Migrate direct modal usage from Chakra to Ant Design#7651
ENG-181: Migrate direct modal usage from Chakra to Ant Design#7651gilluminate merged 9 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Greptile SummaryThis PR migrates 44 components from Chakra UI modal primitives to Ant Design's Key issues found:
Confidence Score: 3/5
Important Files Changed
Last reviewed commit: 3713961 |
clients/admin-ui/src/features/privacy-requests/DenyPrivacyRequestModal.tsx
Outdated
Show resolved
Hide resolved
clients/admin-ui/src/features/configure-consent/ConsentManagementModal.tsx
Show resolved
Hide resolved
clients/admin-ui/src/features/user-management/DeleteUserModal.tsx
Outdated
Show resolved
Hide resolved
| }, | ||
| }} | ||
| data-testid="add-modal-content" | ||
| wrapProps={{ "data-testid": "add-modal-content" }} |
There was a problem hiding this comment.
In Ant Design, data-testid placed directly on goes to the inner .ant-modal div, while wrapProps targets the outer .ant-modal-wrap overlay. However, cy.getByTestId(...) (which uses [data-testid=...]) will find both — so this isn't a test breakage, but it is an inconsistency that could cause confusion for .within() scoping.
Personally, I like the look of data-testid more and they achieve the same thing. I think we should stick with data-testid="delete-user-modal". AddIntegrationModal, SubgroupModal, AddManualTaskModal, CompleteTaskModal, and SkipTaskModal would need to be updated.
There was a problem hiding this comment.
Are you saying you'd prefer updating all of the tests rather than using the wrapProps? Sorry, not sure I understand.
| destroyOnHidden | ||
| open={isOpen} | ||
| onCancel={closeIfComplete} | ||
| title={`${disabled ? "Enable" : "Disable"} Connection`} |
There was a problem hiding this comment.
Good catch! Fixed
Made-with: Cursor
Cypress's `be.visible` check fails when `data-testid` is placed directly
on the Ant Design `<Modal>` component because it lands on `.ant-modal-root`
— a zero-height div whose children are all `position: fixed` and taken out
of normal flow.
Switch to `wrapProps={{ "data-testid": "..." }}` which puts the testid on
`.ant-modal-wrap` — a `position: fixed; inset: 0` container that occupies
the full viewport and passes the visibility check.
Affected: CompleteTaskModal, SkipTaskModal, AddManualTaskModal,
AddIntegrationModal, SubgroupModal, IntegrationLinkedSystems
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Ant Design Modal renders the title in a <span> inside .ant-modal-title, not an <h4> like Chakra Modal did. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace column-settings-close-button testid with .ant-modal-close:visible (Chakra ModalCloseButton was removed, Ant Design has its own close button) - Add dragenter/dragover events before drop for column reorder test (react-dnd HTML5 backend needs the full DnD event sequence to process hover handler where reordering occurs) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move Formik inside Modal so destroyOnHidden resets form state on close - Add cy.getAntModalClose() command to centralize .ant-modal-close selector - Fix ConsentManagementModal width regression (1200px -> 768px via MODAL_SIZE.lg) - Replace div className="flex" with Flex component across 7 modal files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8e7fcef to
ae9e2a6
Compare
Ticket ENG-181
Description Of Changes
Migrate all 44 components that directly used Chakra modal primitives (
ChakraModal,ModalBody,ModalContent,ModalFooter,ModalHeader,ModalOverlay,ModalCloseButton) to Ant Design'sModalcomponent.Key changes beyond the mechanical migration:
DeleteUserModal,NewPasswordModal, andDenyPrivacyRequestModalhad<Form>wrapping<Modal>withhtmlType="submit"buttons in thefooterprop. Because Ant Modal renders footer viaReact.createPortal, the submit button was outside the<form>DOM tree, silently breaking submission. Fixed by usingfooter={null}and rendering buttons inside<Form>within the modal children (matching the pattern inCustomReportCreationModal).MODAL_SIZEconstants — Newmodal-sizes.tswith named widths (md: 576,lg: 768,xl: 992,xxl: 1200) aligned to Ant Design breakpoints. All modals that need non-default widths now use these constants instead of hardcoded values.Header/Footerexports fromlocations/modal.tsx— onlyHeaderCheckboxRowremains (still used byRegulationModalandSubgroupModal).consent-reporting.cy.tsupdated from#chakra-modal-consent-lookup-modaltogetByTestId("consent-lookup-modal").This PR does not migrate the shared modal abstractions (
StandardDialog,FormModal,FilterModal,ConfirmationModal) — those are a separate effort.Code Changes
clients/admin-ui/src/features/common/modals/modal-sizes.ts— New file withMODAL_SIZEconstantsclients/admin-ui/src/features/locations/modal.tsx— Removed unusedHeaderandFooterexportsclients/admin-ui/cypress/e2e/consent-reporting.cy.ts— Replaced Chakra modal ID selector with data-testidclients/admin-ui/src/features/user-management/DeleteUserModal.tsx— Chakra → Ant Modal, fixed portal form submission bugclients/admin-ui/src/features/user-management/NewPasswordModal.tsx— Chakra → Ant Modal, fixed portal form submission bugclients/admin-ui/src/features/privacy-requests/DenyPrivacyRequestModal.tsx— Chakra → Ant Modal, fixed portal form submission bug, removed hardcoded widthclients/admin-ui/src/features/manual-tasks/components/CompleteTaskModal.tsx— Chakra → Ant Modal,width={700}→MODAL_SIZE.lgclients/admin-ui/src/features/manual-tasks/components/SkipTaskModal.tsx— Chakra → Ant Modal,width={700}→MODAL_SIZE.lgopen/onCancel/centered/destroyOnClose/title/footer)Steps to Confirm
Pre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and worksMade with Cursor