Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore: add organization label to workspace template column
  • Loading branch information
Parkreiner committed Sep 3, 2024
commit bfdfd384259205472b0d4f5c00ebc83f94013271
2 changes: 1 addition & 1 deletion site/src/components/AvatarData/AvatarData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const AvatarData: FC<AvatarDataProps> = ({
css={{
fontSize: 13,
color: theme.palette.text.secondary,
lineHeight: "150%",
lineHeight: 1.5,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah the wonderful subtleties of css. so annoying that this actually means something different. 🙃

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CSS is so silly sometimes

maxWidth: 540,
}}
>
Expand Down
29 changes: 27 additions & 2 deletions site/src/pages/WorkspacesPage/WorkspacesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import type { FC, ReactNode } from "react";
import { useNavigate } from "react-router-dom";
import { getDisplayWorkspaceTemplateName } from "utils/workspace";
import { WorkspacesEmpty } from "./WorkspacesEmpty";
import { useDashboard } from "modules/dashboard/useDashboard";
import { visuallyHidden } from "@mui/utils";

export interface WorkspacesTableProps {
workspaces?: readonly Workspace[];
Expand All @@ -52,6 +54,7 @@ export const WorkspacesTable: FC<WorkspacesTableProps> = ({
canCreateTemplate,
}) => {
const theme = useTheme();
const dashboard = useDashboard();

return (
<TableContainer>
Expand Down Expand Up @@ -172,7 +175,7 @@ export const WorkspacesTable: FC<WorkspacesTableProps> = ({
)}
</Stack>
}
subtitle={workspace.owner_name}
subtitle={`user:${workspace.owner_name}`}
avatar={
<ExternalAvatar
src={workspace.template_icon}
Expand All @@ -189,7 +192,29 @@ export const WorkspacesTable: FC<WorkspacesTableProps> = ({
</TableCell>

<TableCell>
{getDisplayWorkspaceTemplateName(workspace)}
<span css={{ display: "block" }}>
{getDisplayWorkspaceTemplateName(workspace)}
</span>

{dashboard.showOrganizations && (
<span
css={{
display: "block",
fontSize: 13,
color: theme.palette.text.secondary,
lineHeight: 1.5,
}}
>
{/*
Only using shorthand version of "organizations" for aesthetics,
but because screen readers don't care about aesthetics, we can
always display the full text to them
*/}
org
<span css={{ ...visuallyHidden }}>anization</span>:
Copy link
Member

@aslilac aslilac Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are screen readers going to handle this split well though? my gut feeling is they say "org anization" with some awful disconnected pronounciation

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it with the built-in Mac screen reader, but (1) I think I was just assuming that any elements that are semantically inline elements wouldn't affect pronunciation, and (2) the Mac screen reader isn't even the most popular reader by a long shot

Let me change this just to be on the safe side

{workspace.organization_name}
</span>
)}
</TableCell>

<TableCell>
Expand Down