Skip to content

Commit

Permalink
Add DialogTitle for accessibility in CommandMenu and fix category key…
Browse files Browse the repository at this point in the history
… usage for better script referencing
  • Loading branch information
BramSuurdje committed Nov 2, 2024
1 parent 2b33fda commit a5093eb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/CommandMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Image from "next/image";
import { useRouter } from "next/navigation";
import React from "react";
import { Button } from "./ui/button";
import { DialogTitle } from "./ui/dialog";

const sortCategories = (categories: Category[]): Category[] => {
return categories.sort((a: Category, b: Category) => {
Expand Down Expand Up @@ -84,17 +85,18 @@ export default function CommandMenu() {
</kbd>
</Button>
<CommandDialog open={open} onOpenChange={setOpen}>
<DialogTitle className="sr-only">Search scripts</DialogTitle>
<CommandInput placeholder="search for a script..." />
<CommandList>
<CommandEmpty>No scripts found.</CommandEmpty>
{links.map((category) => (
<CommandGroup
key={"category:" + category.categoryId}
key={"category:" + category.catagoryName}
heading={category.catagoryName}
>
{category.expand.items.map((script) => (
<CommandItem
key={"script:"+script.id}
key={"script:" + script.id}
value={script.title}
onSelect={() => {
setOpen(false);
Expand Down

0 comments on commit a5093eb

Please sign in to comment.