From f28216fad810d138dab8577fe9bdb39f5b6d18d8 Mon Sep 17 00:00:00 2001 From: George Marshall Date: Wed, 19 Feb 2025 10:48:12 -0800 Subject: [PATCH] fix: cp-12.13.0 fixes drag and drop in network list menu modal (#30437) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** This PR fixes an issue with the drag-and-drop functionality in the network list menu by isolating the modal animation to only use opacity instead of transform. The transform animation was interfering with the `react-beautiful-dnd` library's positioning calculations, causing the draggable items to behave incorrectly. The solution introduces a custom `network-menu-fade` animation in the `index.scss` file for the network menu modal, which only animates opacity and removes the `transform` property. This ensures the drag-and-drop functionality works as expected while maintaining a smooth fade-in animation. ### Key Changes: - Added a custom `network-menu-fade` animation in `index.scss`. - Removed `transform` from the modal to fix drag-and-drop behavior. - Isolated the animation to the network menu component to avoid affecting other modals. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/30437?quickstart=1) ## **Related issues** Fixes: #30436 ## **Manual testing steps** 1. Open the MetaMask extension. 2. Click on the network selector in the top left corner. 3. Try to drag and reorder any of the enabled networks. 4. Verify that the drag-and-drop functionality works smoothly and the modal fades in correctly. ## **Screenshots/Recordings** ### **Before** - Dragging network items was inconsistent or broken due to transform interference. https://github.com/user-attachments/assets/e26cf959-c064-4f12-bad7-6c2308caf50c ### **After** - Network items can be dragged and reordered smoothly. - The modal fades in without any transform-related issues. https://github.com/user-attachments/assets/9052359d-98f6-4267-8d60-92cdef44388b ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability. - [x] I’ve included tests if applicable. - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable. - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- .../multichain/network-list-menu/index.scss | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ui/components/multichain/network-list-menu/index.scss b/ui/components/multichain/network-list-menu/index.scss index 33e4c2b6caae..d8b60b1958ef 100644 --- a/ui/components/multichain/network-list-menu/index.scss +++ b/ui/components/multichain/network-list-menu/index.scss @@ -2,6 +2,22 @@ &__dialog { height: 100vh; max-height: 100%; + // Needed to ensure the drag and drop works. All other modals use a slide up animation with transform: translateY(0) + // https://github.com/MetaMask/metamask-extension/issues/30436 + transform: unset; + + // Custom animation for network menu modal that doesn't use transform: translateY(0) to ensure the drag and drop works + animation: network-menu-fade 400ms cubic-bezier(0.3, 0.8, 0.3, 1) forwards; + } +} + +@keyframes network-menu-fade { + from { + opacity: 0; + } + + to { + opacity: 1; } }