From abcf6063282dc0582758290c187fac30e6f17b3e Mon Sep 17 00:00:00 2001 From: Dustin Healy <54083382+dustinhealy@users.noreply.github.com> Date: Wed, 10 Dec 2025 15:28:45 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=82=20fix:=20My=20Files=20Modal=20Acce?= =?UTF-8?q?ssibility=20Improvements=20(#10844)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: show column sort direction in all headers for my files datatable * fix: refactor SortFilterHeader to use DropdownPopup so that keyboard nav and portaling actually work * feat: visually indicate when a column filter is active * chore: remove debug visuals * chore: fix types and import order * chore: add missing subItems prop to MenuItemProps interface * feat: add arrow indicator for name column * fix: page counter no longer shows 1/0 when no results * feat: keep my files datatable size consistent to avoid issues with sizing of dropdown filter menus which made it difficult to see options * fix: refactor filter cols button in my files datatable to use ariakit dropdown so keyboard nav works * feat: better datatable column spacing following tanstack docs * chore: ESlint complaints * fix: localize string literals * fix: move localize hook call inside the function components * feat: add tooltip label for select all * feat: better styling on floating label for file filter input * feat: focus outline on search input * feat: add search icon * feat: add aria-sort props to header sort buttons * feat: better screen reader labels to include information visually conveyed by filter and sort icons * feat: add descriptive tooltips for headers for better accessibility for cognitive impairments * chore: import orders * feat: add more aria states for better feedback of filtered and sorted columns * chore: add translation key --- client/src/common/menus.ts | 1 + .../Files/Table/ColumnVisibilityDropdown.tsx | 59 +++++ .../Chat/Input/Files/Table/Columns.tsx | 129 +++++++++-- .../Chat/Input/Files/Table/DataTable.tsx | 109 ++++----- .../Input/Files/Table/SortFilterHeader.tsx | 206 ++++++++++-------- client/src/locales/en/translation.json | 6 + packages/client/src/common/menus.ts | 2 + .../client/src/components/DropdownPopup.tsx | 1 + 8 files changed, 336 insertions(+), 177 deletions(-) create mode 100644 client/src/components/Chat/Input/Files/Table/ColumnVisibilityDropdown.tsx diff --git a/client/src/common/menus.ts b/client/src/common/menus.ts index d0d81460dd..97c2d1b11b 100644 --- a/client/src/common/menus.ts +++ b/client/src/common/menus.ts @@ -16,6 +16,7 @@ export interface MenuItemProps { hideOnClick?: boolean; dialog?: React.ReactElement; ref?: React.Ref; + className?: string; render?: | RenderProp & { ref?: React.Ref | undefined }> | React.ReactElement> diff --git a/client/src/components/Chat/Input/Files/Table/ColumnVisibilityDropdown.tsx b/client/src/components/Chat/Input/Files/Table/ColumnVisibilityDropdown.tsx new file mode 100644 index 0000000000..8401db6d38 --- /dev/null +++ b/client/src/components/Chat/Input/Files/Table/ColumnVisibilityDropdown.tsx @@ -0,0 +1,59 @@ +import { useState, useId, useMemo } from 'react'; +import { ListFilter } from 'lucide-react'; +import * as Menu from '@ariakit/react/menu'; +import { useReactTable } from '@tanstack/react-table'; +import { DropdownPopup } from '@librechat/client'; +import { useLocalize, TranslationKeys } from '~/hooks'; +import { cn } from '~/utils'; + +interface ColumnVisibilityDropdownProps { + table: ReturnType>; + contextMap: Record; + isSmallScreen: boolean; +} + +export function ColumnVisibilityDropdown({ + table, + contextMap, + isSmallScreen, +}: ColumnVisibilityDropdownProps) { + const localize = useLocalize(); + const menuId = useId(); + const [isOpen, setIsOpen] = useState(false); + + const dropdownItems = useMemo( + () => + table + .getAllColumns() + .filter((column) => column.getCanHide()) + .map((column) => ({ + label: localize(contextMap[column.id]), + onClick: () => column.toggleVisibility(!column.getIsVisible()), + icon: column.getIsVisible() ? '✓' : '', + id: column.id, + })), + [table, contextMap, localize], + ); + + return ( + +