diff --git a/site/src/pages/LoginPage/OAuthSignInForm.tsx b/site/src/pages/LoginPage/OAuthSignInForm.tsx index 6c75c5ec74cff..e8f289f122bcf 100644 --- a/site/src/pages/LoginPage/OAuthSignInForm.tsx +++ b/site/src/pages/LoginPage/OAuthSignInForm.tsx @@ -2,9 +2,10 @@ import Button from "@mui/material/Button"; import GitHubIcon from "@mui/icons-material/GitHub"; import KeyIcon from "@mui/icons-material/VpnKey"; import Box from "@mui/material/Box"; -import { type FC } from "react"; +import { useId, type FC } from "react"; import { Language } from "./SignInForm"; import { type AuthMethods } from "api/typesGenerated"; +import { visuallyHidden } from "@mui/utils"; type OAuthSignInFormProps = { isSigningIn: boolean; @@ -12,16 +13,16 @@ type OAuthSignInFormProps = { authMethods?: AuthMethods; }; +const iconStyles = { + width: 16, + height: 16, +}; + export const OAuthSignInForm: FC = ({ isSigningIn, redirectTo, authMethods, }) => { - const iconStyles = { - width: 16, - height: 16, - }; - return ( {authMethods?.github.enabled && ( @@ -51,11 +52,7 @@ export const OAuthSignInForm: FC = ({ size="xlarge" startIcon={ authMethods.oidc.iconUrl ? ( - Open ID Connect icon + ) : ( ) @@ -70,3 +67,24 @@ export const OAuthSignInForm: FC = ({ ); }; + +type OidcIconProps = { + iconUrl: string; +}; + +function OidcIcon({ iconUrl }: OidcIconProps) { + const hookId = useId(); + const oidcId = `${hookId}-oidc`; + + // Even if the URL is defined, there is a chance that the request for the + // image fails. Have to use blank alt text to avoid button from getting ugly + // if that happens, but also still need a way to inject accessible text + return ( + <> + +
+ Open ID Connect +
+ + ); +}