From 6b1896409290e17fd25bf3dea7e890fc2c5a4583 Mon Sep 17 00:00:00 2001 From: Dion Date: Sun, 5 Nov 2023 19:40:34 +0100 Subject: [PATCH] add keydowns --- .../organisms/menu-trash/menu-trash.tsx | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/starsky/starsky/clientapp/src/components/organisms/menu-trash/menu-trash.tsx b/starsky/starsky/clientapp/src/components/organisms/menu-trash/menu-trash.tsx index fdf0f3fec3..17656a2b1f 100644 --- a/starsky/starsky/clientapp/src/components/organisms/menu-trash/menu-trash.tsx +++ b/starsky/starsky/clientapp/src/components/organisms/menu-trash/menu-trash.tsx @@ -142,6 +142,9 @@ const MenuTrash: React.FunctionComponent = ({ onClick={() => { removeSidebarSelection(); }} + onKeyDown={(event) => { + event.key === "Enter" && removeSidebarSelection(); + }} className="item item--first item--close" > {MessageNoneSelected} @@ -152,6 +155,9 @@ const MenuTrash: React.FunctionComponent = ({ onClick={() => { removeSidebarSelection(); }} + onKeyDown={(event) => { + event.key === "Enter" && removeSidebarSelection(); + }} className="item item--first item--close" > {select.length} {MessageSelectPresentPerfect} @@ -165,6 +171,9 @@ const MenuTrash: React.FunctionComponent = ({ onClick={() => { removeSidebarSelection(); }} + onKeyDown={(event) => { + event.key === "Enter" && removeSidebarSelection(); + }} > {MessageSelectAction} @@ -212,6 +221,10 @@ const MenuTrash: React.FunctionComponent = ({ data-test="undo-selection" className="menu-option" onClick={() => undoSelection()} + tabIndex={0} + onKeyDown={(event) => { + event.key === "Enter" && undoSelection(); + }} > {MessageUndoSelection} @@ -221,6 +234,10 @@ const MenuTrash: React.FunctionComponent = ({ className="menu-option" data-test="select-all" onClick={() => allSelection()} + tabIndex={0} + onKeyDown={(event) => { + event.key === "Enter" && allSelection(); + }} > {MessageSelectAll} @@ -229,6 +246,10 @@ const MenuTrash: React.FunctionComponent = ({ className="menu-option" data-test="restore-from-trash" onClick={() => undoTrash()} + tabIndex={0} + onKeyDown={(event) => { + event.key === "Enter" && undoTrash(); + }} > {MessageRestoreFromTrash} @@ -236,6 +257,10 @@ const MenuTrash: React.FunctionComponent = ({ className="menu-option" data-test="delete" onClick={() => setModalDeleteOpen(true)} + tabIndex={0} + onKeyDown={(event) => { + event.key === "Enter" && setModalDeleteOpen(true); + }} > {MessageDeleteImmediately}