diff --git a/src/reactviews/pages/ConnectionDialog/connectionsListContainer.tsx b/src/reactviews/pages/ConnectionDialog/connectionsListContainer.tsx index a9f4d1291a..db45153b35 100644 --- a/src/reactviews/pages/ConnectionDialog/connectionsListContainer.tsx +++ b/src/reactviews/pages/ConnectionDialog/connectionsListContainer.tsx @@ -14,7 +14,7 @@ import { makeStyles, tokens, } from "@fluentui/react-components"; -import { MouseEventHandler, useContext, useEffect, useState } from "react"; +import { KeyboardEventHandler, MouseEventHandler, useContext, useEffect, useState } from "react"; import { ConnectionDialogContext } from "./connectionDialogStateProvider"; import { IConnectionDialogProfile } from "../../../sharedInterfaces/connectionDialog"; @@ -81,7 +81,10 @@ export const ConnectionsListContainer = () => { onClick={context.refreshConnectionsList} /> -
+
{// state may not be initialized yet due to async loading of context context.state?.savedConnections.map((connection, index) => { return ( @@ -110,7 +113,7 @@ export const ConnectionsListContainer = () => { onClick={context.refreshConnectionsList} />
- + {// state may not be initialized yet due to async loading of context context.state?.recentConnections.map((connection, index) => { return ( @@ -173,29 +176,45 @@ export const ConnectionCard = ({ return undefined; } + const handleClick = () => { + context.loadConnection(connection); + }; + + const handleKeyDown: KeyboardEventHandler = (event) => { + if (event.key === "Enter" || event.key === " ") { + event.preventDefault(); + handleClick(); + } + }; + return ( - { - context.loadConnection(connection); - }}> - } - header={displayName} - action={ - actionButton && ( -
-
- ) - } - /> -
+
+ + } + header={displayName} + action={ + actionButton && ( +
+
+ ) + } + /> +
+
); };