Skip to content

Commit 4b68601

Browse files
author
Fabio Bozzo
authored
fix: hide account menu in dapp connection flow (#37704)
## **Description** Fixes a bug where clicking the account details menu (3 dots) in the Connect to dapp screen does nothing. The menu should not be displayed in this flow since users are selecting accounts via checkboxes, not accessing account details. **Changes:** - Hide the account menu (`MultichainAccountMenu`) in `MultichainAccountList` when in account selection mode (`showAccountCheckbox` is true) - Added test coverage to verify the menu is properly hidden during account selection [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/37704?quickstart=1) ## **Changelog** CHANGELOG entry: Fixed account details menu appearing in dapp connection account selection ## **Related issues** Fixes: #37604 ## **Manual testing steps** 1. Go to the test dapp (https://metamask.github.io/test-dapp/) 2. Click "Connect" button 3. Click "Edit Accounts" in the connection modal 4. Verify that the 3 dots menu is **NOT** visible next to each account 5. Close the edit accounts modal 6. Open the main account menu from the extension 7. Verify that the 3 dots menu IS visible in the normal account list ## **Screenshots/Recordings** ### **Before** Account menu (3 dots) was visible but non-functional in the edit accounts flow during dapp connection ([see bug](#37604)). ### **After** Account menu (3 dots) is now hidden in the edit accounts flow, only checkboxes are shown for account selection: <img width="1166" height="870" alt="Screenshot 2025-11-11 at 13 28 08" src="https://github.com/user-attachments/assets/8d40621a-ad91-4010-b5a3-71dcccf906e2" /> ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Hide the per-account menu when `showAccountCheckbox` is true in `MultichainAccountList`, with tests verifying the menu is not rendered. > > - **Frontend** > - **`ui/components/multichain-accounts/multichain-account-list/multichain-account-list.tsx`**: > - Conditionally render `MultichainAccountMenu` only when `showAccountCheckbox` is false (`showAccountMenu = !showAccountCheckbox`). > - **Tests** > - **`multichain-account-list.test.tsx`**: > - Add test to assert the 3-dots account menu is hidden when `showAccountCheckbox` is true. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 40b264c. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 29dc0f4 commit 4b68601

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

ui/components/multichain-accounts/multichain-account-list/multichain-account-list.test.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,30 @@ describe('MultichainAccountList', () => {
751751
),
752752
).not.toBeInTheDocument();
753753
});
754+
755+
it('hides account menu (3 dots) when showAccountCheckbox is true', () => {
756+
const { rerender } = renderComponent({
757+
selectedAccountGroups: [walletOneGroupId],
758+
showAccountCheckbox: false,
759+
});
760+
761+
// With checkboxes disabled, menu buttons should be visible
762+
let menuButtons = document.querySelectorAll(menuButtonSelector);
763+
expect(menuButtons.length).toBe(2);
764+
765+
// Enable checkboxes
766+
rerender(
767+
<MultichainAccountList
768+
wallets={mockWallets}
769+
selectedAccountGroups={[walletOneGroupId]}
770+
showAccountCheckbox={true}
771+
/>,
772+
);
773+
774+
// With checkboxes enabled, menu buttons should be hidden
775+
menuButtons = document.querySelectorAll(menuButtonSelector);
776+
expect(menuButtons.length).toBe(0);
777+
});
754778
});
755779

756780
describe('Connection Status', () => {

ui/components/multichain-accounts/multichain-account-list/multichain-account-list.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ export const MultichainAccountList = ({
8787
showAccountCheckbox = false,
8888
showConnectionStatus = false,
8989
}: MultichainAccountListProps) => {
90+
const showAccountMenu = !showAccountCheckbox;
91+
9092
const dispatch = useDispatch();
9193
const history = useHistory();
9294
const trackEvent = useContext(MetaMetricsContext);
@@ -293,13 +295,15 @@ export const MultichainAccountList = ({
293295
) : undefined
294296
}
295297
endAccessory={
296-
<MultichainAccountMenu
297-
accountGroupId={groupId as AccountGroupId}
298-
isRemovable={isRemovable}
299-
handleAccountRenameAction={handleAccountRenameAction}
300-
isOpen={openMenuAccountId === groupId}
301-
onToggle={() => handleMenuToggle(groupId as AccountGroupId)}
302-
/>
298+
showAccountMenu ? (
299+
<MultichainAccountMenu
300+
accountGroupId={groupId as AccountGroupId}
301+
isRemovable={isRemovable}
302+
handleAccountRenameAction={handleAccountRenameAction}
303+
isOpen={openMenuAccountId === groupId}
304+
onToggle={() => handleMenuToggle(groupId as AccountGroupId)}
305+
/>
306+
) : undefined
303307
}
304308
/>
305309
</Box>

0 commit comments

Comments
 (0)