Skip to content

Commit

Permalink
add keydowns
Browse files Browse the repository at this point in the history
  • Loading branch information
qdraw committed Nov 5, 2023
1 parent 6f3bd5e commit 6b18964
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ const MenuTrash: React.FunctionComponent<IMenuTrashProps> = ({
onClick={() => {
removeSidebarSelection();
}}
onKeyDown={(event) => {
event.key === "Enter" && removeSidebarSelection();
}}
className="item item--first item--close"
>
{MessageNoneSelected}
Expand All @@ -152,6 +155,9 @@ const MenuTrash: React.FunctionComponent<IMenuTrashProps> = ({
onClick={() => {
removeSidebarSelection();
}}
onKeyDown={(event) => {
event.key === "Enter" && removeSidebarSelection();
}}
className="item item--first item--close"
>
{select.length} {MessageSelectPresentPerfect}
Expand All @@ -165,6 +171,9 @@ const MenuTrash: React.FunctionComponent<IMenuTrashProps> = ({
onClick={() => {
removeSidebarSelection();
}}
onKeyDown={(event) => {
event.key === "Enter" && removeSidebarSelection();
}}
>
{MessageSelectAction}
</div>
Expand Down Expand Up @@ -212,6 +221,10 @@ const MenuTrash: React.FunctionComponent<IMenuTrashProps> = ({
data-test="undo-selection"
className="menu-option"
onClick={() => undoSelection()}
tabIndex={0}
onKeyDown={(event) => {
event.key === "Enter" && undoSelection();
}}
>
{MessageUndoSelection}
</li>
Expand All @@ -221,6 +234,10 @@ const MenuTrash: React.FunctionComponent<IMenuTrashProps> = ({
className="menu-option"
data-test="select-all"
onClick={() => allSelection()}
tabIndex={0}
onKeyDown={(event) => {
event.key === "Enter" && allSelection();
}}
>
{MessageSelectAll}
</li>
Expand All @@ -229,13 +246,21 @@ const MenuTrash: React.FunctionComponent<IMenuTrashProps> = ({
className="menu-option"
data-test="restore-from-trash"
onClick={() => undoTrash()}
tabIndex={0}
onKeyDown={(event) => {
event.key === "Enter" && undoTrash();
}}
>
{MessageRestoreFromTrash}
</li>
<li
className="menu-option"
data-test="delete"
onClick={() => setModalDeleteOpen(true)}
tabIndex={0}
onKeyDown={(event) => {
event.key === "Enter" && setModalDeleteOpen(true);
}}
>
{MessageDeleteImmediately}
</li>
Expand Down

0 comments on commit 6b18964

Please sign in to comment.