From a185457067c74c97d579cc3abe237a2dfb89578e Mon Sep 17 00:00:00 2001 From: David Lechner Date: Fri, 13 May 2022 16:48:32 -0500 Subject: [PATCH] explorer: don't disable archive button disabled buttons are bad for accessability --- src/explorer/Explorer.test.tsx | 14 +------------- src/explorer/Explorer.tsx | 6 ------ src/explorer/sagas.test.ts | 8 ++++++++ src/explorer/sagas.ts | 4 ++++ 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/explorer/Explorer.test.tsx b/src/explorer/Explorer.test.tsx index 4d0ec88e..aaede04f 100644 --- a/src/explorer/Explorer.test.tsx +++ b/src/explorer/Explorer.test.tsx @@ -29,7 +29,7 @@ const testFile: ExplorerFileInfo = { }; describe('archive button', () => { - it('should be enabled if there are files', () => { + it('should dispatch action when clicked', () => { const [explorer, dispatch] = testRender(, { explorer: { files: [testFile] }, }); @@ -40,18 +40,6 @@ describe('archive button', () => { userEvent.click(button); expect(dispatch).toHaveBeenCalledWith(explorerArchiveAllFiles()); }); - - it('should be disabled if there are no files', () => { - const [explorer, dispatch] = testRender(, { - explorer: { files: [] }, - }); - - const button = explorer.getByTitle('Backup all files'); - expect(button).toBeDisabled(); - - userEvent.click(button); - expect(dispatch).not.toHaveBeenCalled(); - }); }); describe('import file button', () => { diff --git a/src/explorer/Explorer.tsx b/src/explorer/Explorer.tsx index 1687bddb..65fa8f66 100644 --- a/src/explorer/Explorer.tsx +++ b/src/explorer/Explorer.tsx @@ -46,8 +46,6 @@ type ActionButtonProps = { icon: IconName; /** The tooltip/title text. */ tooltip: string; - /** If provided, controls button disabled state. */ - disabled?: boolean; /** If false, prevent focus. Default is true. */ focusable?: boolean; /** Callback for button click event. */ @@ -57,7 +55,6 @@ type ActionButtonProps = { const ActionButton: React.VoidFunctionComponent = ({ icon, tooltip, - disabled, focusable, onClick, }) => { @@ -74,7 +71,6 @@ const ActionButton: React.VoidFunctionComponent = ({