Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions components/tools/Filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ export default function Filters({ setOpenFilter }: FiltersProps) {
setRead={setReadMore}
/>
</div>
<div className='mb-0 flex cursor-pointer gap-0.5 text-xs hover:underline' onClick={undoChanges}>
<button type='button' className='mb-0 flex cursor-pointer gap-0.5 bg-transparent text-xs hover:underline' onClick={undoChanges}>
Undo Changes
</div>
</button>
</div>
<div className='flex gap-2' data-testid='Applied-filters'>
<div
Expand Down
18 changes: 10 additions & 8 deletions components/tools/ToolsDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,31 +176,33 @@ export default function ToolsDashboard() {
<div className='my-10 flex flex-wrap justify-between gap-4 lg:flex-nowrap'>
<div className='flex h-auto w-[47%] gap-5 lg:w-1/5'>
<div className='relative h-auto w-full' ref={filterRef as React.LegacyRef<HTMLDivElement>}>
<div
<button
type='button'
className='flex h-14 w-full cursor-pointer items-center justify-center gap-2 rounded-lg border border-gray-300 px-4 py-1 text-sm text-gray-700 shadow hover:border-gray-600 hover:shadow-md'
onClick={() => setOpenFilter(!openFilter)}
data-testid='ToolsDashboard-Filters-Click'
>
<FilterIcon />
<div>Filter</div>
</div>
<span>Filter</span>
</button>
{openFilter && (
<button className='absolute top-16 z-20 min-w-[20rem]'>
<div className='absolute top-16 z-20 min-w-[20rem]' role='menu'>
<Filters setOpenFilter={setOpenFilter} />
</button>
</div>
Comment on lines +179 to +191
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Don’t expose the filter panel as an ARIA menu.

Line 189 adds role='menu', but Filters renders form-like controls rather than menuitem descendants. Use a plain container and wire it to the trigger with expanded/control state.

♿ Proposed fix
               <button
                 type='button'
+                aria-expanded={openFilter}
+                aria-controls='tools-filter-panel'
                 className='flex h-14 w-full cursor-pointer items-center justify-center gap-2 rounded-lg border border-gray-300 px-4 py-1 text-sm text-gray-700 shadow hover:border-gray-600 hover:shadow-md'
                 onClick={() => setOpenFilter(!openFilter)}
                 data-testid='ToolsDashboard-Filters-Click'
               >
@@
               </button>
               {openFilter && (
-                <div className='absolute top-16 z-20 min-w-[20rem]' role='menu'>
+                <div id='tools-filter-panel' className='absolute top-16 z-20 min-w-[20rem]'>
                   <Filters setOpenFilter={setOpenFilter} />
                 </div>
               )}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<button
type='button'
className='flex h-14 w-full cursor-pointer items-center justify-center gap-2 rounded-lg border border-gray-300 px-4 py-1 text-sm text-gray-700 shadow hover:border-gray-600 hover:shadow-md'
onClick={() => setOpenFilter(!openFilter)}
data-testid='ToolsDashboard-Filters-Click'
>
<FilterIcon />
<div>Filter</div>
</div>
<span>Filter</span>
</button>
{openFilter && (
<button className='absolute top-16 z-20 min-w-[20rem]'>
<div className='absolute top-16 z-20 min-w-[20rem]' role='menu'>
<Filters setOpenFilter={setOpenFilter} />
</button>
</div>
<button
type='button'
aria-expanded={openFilter}
aria-controls='tools-filter-panel'
className='flex h-14 w-full cursor-pointer items-center justify-center gap-2 rounded-lg border border-gray-300 px-4 py-1 text-sm text-gray-700 shadow hover:border-gray-600 hover:shadow-md'
onClick={() => setOpenFilter(!openFilter)}
data-testid='ToolsDashboard-Filters-Click'
>
<FilterIcon />
<span>Filter</span>
</button>
{openFilter && (
<div id='tools-filter-panel' className='absolute top-16 z-20 min-w-[20rem]'>
<Filters setOpenFilter={setOpenFilter} />
</div>
)}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/tools/ToolsDashboard.tsx` around lines 179 - 191, The container
for the filter panel in ToolsDashboard currently uses role='menu' which is
incorrect because Filters renders form controls, so remove role='menu' from the
panel and instead connect the trigger button and panel with accessible state:
add aria-expanded={openFilter} to the Filter button (the onClick that toggles
openFilter) and give the panel a stable id (e.g., filters-panel) then add
aria-controls="filters-panel" on the button; keep the panel as a plain div (no
menu/menuitem roles) and ensure Filters receives setOpenFilter so closing logic
remains intact.

)}
</div>
</div>
<div className='flex h-auto w-[47%] gap-5 lg:w-1/5'>
<div className='relative h-auto w-full' ref={categoryRef as React.LegacyRef<HTMLDivElement>}>
<div
<button
type='button'
className='flex h-14 w-full cursor-pointer items-center justify-center gap-2 rounded-lg border border-gray-300 px-4 py-1 text-sm text-gray-700 shadow hover:border-gray-600 hover:shadow-md'
onClick={() => setopenCategory(!openCategory)}
data-testid='ToolsDashboard-category'
>
<div>Jump to Category</div>
<span>Jump to Category</span>
<ArrowDown className={`my-auto ${openCategory ? 'rotate-180' : ''}`} />
</div>
</button>
{openCategory && (
<div className='absolute right-52 top-16 z-20'>
Comment on lines +197 to 207
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Expose the Jump to Category expanded state.

The trigger is now keyboard-operable, but screen readers still won’t know whether the dropdown is open. Add aria-expanded and connect it to the popup.

♿ Proposed fix
               <button
                 type='button'
+                aria-expanded={openCategory}
+                aria-controls='tools-category-dropdown'
                 className='flex h-14 w-full cursor-pointer items-center justify-center gap-2 rounded-lg border border-gray-300 px-4 py-1 text-sm text-gray-700 shadow hover:border-gray-600 hover:shadow-md'
                 onClick={() => setopenCategory(!openCategory)}
                 data-testid='ToolsDashboard-category'
               >
@@
               </button>
               {openCategory && (
-                <div className='absolute right-52 top-16 z-20'>
+                <div id='tools-category-dropdown' className='absolute right-52 top-16 z-20'>
                   <CategoryDropdown setopenCategory={setopenCategory} />
                 </div>
               )}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<button
type='button'
className='flex h-14 w-full cursor-pointer items-center justify-center gap-2 rounded-lg border border-gray-300 px-4 py-1 text-sm text-gray-700 shadow hover:border-gray-600 hover:shadow-md'
onClick={() => setopenCategory(!openCategory)}
data-testid='ToolsDashboard-category'
>
<div>Jump to Category</div>
<span>Jump to Category</span>
<ArrowDown className={`my-auto ${openCategory ? 'rotate-180' : ''}`} />
</div>
</button>
{openCategory && (
<div className='absolute right-52 top-16 z-20'>
<button
type='button'
aria-expanded={openCategory}
aria-controls='tools-category-dropdown'
className='flex h-14 w-full cursor-pointer items-center justify-center gap-2 rounded-lg border border-gray-300 px-4 py-1 text-sm text-gray-700 shadow hover:border-gray-600 hover:shadow-md'
onClick={() => setopenCategory(!openCategory)}
data-testid='ToolsDashboard-category'
>
<span>Jump to Category</span>
<ArrowDown className={`my-auto ${openCategory ? 'rotate-180' : ''}`} />
</button>
{openCategory && (
<div id='tools-category-dropdown' className='absolute right-52 top-16 z-20'>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/tools/ToolsDashboard.tsx` around lines 197 - 207, The button
toggle for the category dropdown currently uses openCategory and setopenCategory
but does not expose state to assistive tech; update the button element rendered
in ToolsDashboard (the toggle that calls setopenCategory and uses openCategory)
to include aria-expanded tied to openCategory (aria-expanded={openCategory}) and
add aria-controls pointing to the popup container's id, and give the popup div a
matching unique id and an appropriate landmark/role (e.g., role="menu" or
role="region") so screen readers can associate the button with the popup; ensure
the popup div that renders when openCategory is true (the div with className
'absolute right-52 top-16 z-20') receives that id.

<CategoryDropdown setopenCategory={setopenCategory} />
Expand Down
Loading