Skip to content

Commit

Permalink
temp+fix: cp-12.13.0 fixes drag and drop in network list menu modal (#…
Browse files Browse the repository at this point in the history
…30437)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **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**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->
- Dragging network items was inconsistent or broken due to transform
interference.

https://github.com/user-attachments/assets/e26cf959-c064-4f12-bad7-6c2308caf50c

### **After**

<!-- [screenshots/recordings] -->
- 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.
  • Loading branch information
runway-github[bot] authored Feb 19, 2025
2 parents 6cb597d + f28216f commit d11a301
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ui/components/multichain/network-list-menu/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit d11a301

Please sign in to comment.