From bd09ecebf26f635aa08a7d25fb5b60c2e9417c22 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Thu, 5 Sep 2024 09:55:35 -0500 Subject: [PATCH 1/3] fix: Don't show AccountListMenu back button by default --- .../multichain/account-list-menu/account-list-menu.test.tsx | 1 + .../multichain/account-list-menu/account-list-menu.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/components/multichain/account-list-menu/account-list-menu.test.tsx b/ui/components/multichain/account-list-menu/account-list-menu.test.tsx index 60e1ca8aa99f..c55116bd2d93 100644 --- a/ui/components/multichain/account-list-menu/account-list-menu.test.tsx +++ b/ui/components/multichain/account-list-menu/account-list-menu.test.tsx @@ -117,6 +117,7 @@ describe('AccountListMenu', () => { expect(getByPlaceholderText('Search accounts')).toBeInTheDocument(); expect(getByText('Add account or hardware wallet')).toBeInTheDocument(); + expect(document.querySelector('[aria-label="Back"]')).toStrictEqual(null); }); it('displays accounts for list and filters by search', () => { diff --git a/ui/components/multichain/account-list-menu/account-list-menu.tsx b/ui/components/multichain/account-list-menu/account-list-menu.tsx index abffdb83afe5..e2d5b6c4ba24 100644 --- a/ui/components/multichain/account-list-menu/account-list-menu.tsx +++ b/ui/components/multichain/account-list-menu/account-list-menu.tsx @@ -289,7 +289,7 @@ export const AccountListMenu = ({ ); // eslint-disable-next-line no-empty-function - let onBack = () => {}; + let onBack = null; if (actionMode !== ACTION_MODES.LIST) { if (actionMode === ACTION_MODES.MENU) { onBack = () => setActionMode(ACTION_MODES.LIST); From 3433d1aa760f9bc3516aab643aaf3db3a1b10559 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Thu, 5 Sep 2024 13:08:50 -0500 Subject: [PATCH 2/3] Fix jest --- .../component-library/modal-header/modal-header.types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/components/component-library/modal-header/modal-header.types.ts b/ui/components/component-library/modal-header/modal-header.types.ts index 5d3d9e3ae713..ccb5b995ec30 100644 --- a/ui/components/component-library/modal-header/modal-header.types.ts +++ b/ui/components/component-library/modal-header/modal-header.types.ts @@ -25,7 +25,7 @@ export interface ModalHeaderProps extends HeaderBaseStyleUtilityProps { * The onClick handler for the back `ButtonIcon` * When passed this will allow for the back `ButtonIcon` to show */ - onBack?: () => void; + onBack?: () => void | null; /** * The props to pass to the back `ButtonIcon` */ From 308299fb37b837eb69b8fc53293ebefbb04427da Mon Sep 17 00:00:00 2001 From: David Walsh Date: Thu, 5 Sep 2024 13:30:38 -0500 Subject: [PATCH 3/3] Switch to undefined --- .../component-library/modal-header/modal-header.types.ts | 2 +- .../multichain/account-list-menu/account-list-menu.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/components/component-library/modal-header/modal-header.types.ts b/ui/components/component-library/modal-header/modal-header.types.ts index ccb5b995ec30..eac7ba56d8db 100644 --- a/ui/components/component-library/modal-header/modal-header.types.ts +++ b/ui/components/component-library/modal-header/modal-header.types.ts @@ -25,7 +25,7 @@ export interface ModalHeaderProps extends HeaderBaseStyleUtilityProps { * The onClick handler for the back `ButtonIcon` * When passed this will allow for the back `ButtonIcon` to show */ - onBack?: () => void | null; + onBack?: () => void | undefined; /** * The props to pass to the back `ButtonIcon` */ diff --git a/ui/components/multichain/account-list-menu/account-list-menu.tsx b/ui/components/multichain/account-list-menu/account-list-menu.tsx index e2d5b6c4ba24..b0440d0d09bb 100644 --- a/ui/components/multichain/account-list-menu/account-list-menu.tsx +++ b/ui/components/multichain/account-list-menu/account-list-menu.tsx @@ -289,7 +289,7 @@ export const AccountListMenu = ({ ); // eslint-disable-next-line no-empty-function - let onBack = null; + let onBack; if (actionMode !== ACTION_MODES.LIST) { if (actionMode === ACTION_MODES.MENU) { onBack = () => setActionMode(ACTION_MODES.LIST);