Skip to content

Commit f41f658

Browse files
committed
fix: do not wrap command item with link
1 parent 0f3907e commit f41f658

File tree

2 files changed

+21
-22
lines changed

2 files changed

+21
-22
lines changed

site/src/components/Command/Command.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export const CommandItem = forwardRef<
119119
<CommandPrimitive.Item
120120
ref={ref}
121121
className={cn(
122-
`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-2 text-sm font-medium outline-none
122+
`relative flex cursor-default gap-2 select-none text-content-secondary items-center rounded-sm px-2 py-2 text-sm font-medium outline-none
123123
data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50
124124
data-[selected=true]:bg-surface-secondary data-[selected=true]:text-content-primary
125125
[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,

site/src/modules/management/OrganizationSidebarView.tsx

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import type { Permissions } from "contexts/auth/permissions";
2121
import { ChevronDown, Plus } from "lucide-react";
2222
import { useDashboard } from "modules/dashboard/useDashboard";
2323
import { type FC, useState } from "react";
24+
import { useNavigate } from "react-router-dom";
2425
import { Link } from "react-router-dom";
2526

2627
export interface OrganizationWithPermissions extends Organization {
@@ -87,6 +88,7 @@ const OrganizationsSettingsNavigation: FC<
8788
}
8889

8990
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
91+
const navigate = useNavigate();
9092

9193
return (
9294
<>
@@ -114,33 +116,30 @@ const OrganizationsSettingsNavigation: FC<
114116
</PopoverTrigger>
115117
<PopoverContent align="start" className="w-60">
116118
<Command>
119+
{/* <button type="button" className="sr-only" /> */}
117120
<CommandList>
118121
<CommandGroup className="pb-2">
119122
{organizations.length > 1 && (
120123
<div className="flex flex-col max-h-[260px] overflow-y-auto">
121124
{organizations.map((organization) => (
122-
<Link
125+
<CommandItem
123126
key={organization.id}
124-
to={urlForSubpage(organization.name)}
125-
// Setting width to 215px so that outline is visible
126-
className="w-[215px] ml-1 no-underline visited:text-content-secondary text-content-secondary"
127+
value={organization.name}
128+
onSelect={() => {
129+
setIsPopoverOpen(false);
130+
navigate(urlForSubpage(organization.name));
131+
}}
132+
tabIndex={0}
127133
>
128-
<CommandItem
129-
value={organization.name}
130-
onSelect={() => {
131-
setIsPopoverOpen(false);
132-
}}
133-
>
134-
<Avatar
135-
size="sm"
136-
src={organization.icon}
137-
fallback={organization.display_name}
138-
/>
139-
<span className="truncate">
140-
{organization?.display_name || organization?.name}
141-
</span>
142-
</CommandItem>
143-
</Link>
134+
<Avatar
135+
size="sm"
136+
src={organization.icon}
137+
fallback={organization.display_name}
138+
/>
139+
<span className="truncate">
140+
{organization?.display_name || organization?.name}
141+
</span>
142+
</CommandItem>
144143
))}
145144
</div>
146145
)}
@@ -149,7 +148,7 @@ const OrganizationsSettingsNavigation: FC<
149148
{organizations.length > 1 && (
150149
<hr className="h-px my-2 border-none bg-border -mx-2" />
151150
)}
152-
<Button variant="subtle" className="w-full h-8">
151+
<Button asChild variant="subtle" className="w-full h-8">
153152
<a
154153
href="/organizations/new"
155154
className="flex items-center gap-1 no-underline text-content-secondary hover:text-content-primary visited:text-content-secondary"

0 commit comments

Comments
 (0)