mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-17 16:05:32 +01:00
👐 a11y: Accessible Conversation Menu Options (#3864)
* fix: type issues * feat: Fix document title setting in Conversation component * style: new chat theme * fix: No keyboard access to chat menus in the chat history #3788 * fix: Menu button in the chat history area does not indicate its state #3823 * refactor: use ariakit for DropdownPopup * style: update sticky z-index in NewChat component * style: update ConvoOptions menu button styling
This commit is contained in:
parent
2ce4f66218
commit
0a359aa705
6 changed files with 122 additions and 131 deletions
|
|
@ -1,12 +1,13 @@
|
|||
import { useState } from 'react';
|
||||
import { useState, useId } from 'react';
|
||||
import * as Ariakit from '@ariakit/react';
|
||||
import { Ellipsis, Share2, Archive, Pen, Trash } from 'lucide-react';
|
||||
import { useGetStartupConfig } from 'librechat-data-provider/react-query';
|
||||
import { Button } from '~/components/ui';
|
||||
import { useArchiveHandler } from './ArchiveButton';
|
||||
import { DropdownPopup } from '~/components/ui';
|
||||
import DeleteButton from './DeleteButton';
|
||||
import ShareButton from './ShareButton';
|
||||
import { useLocalize } from '~/hooks';
|
||||
import { cn } from '~/utils';
|
||||
|
||||
export default function ConvoOptions({
|
||||
conversation,
|
||||
|
|
@ -57,27 +58,29 @@ export default function ConvoOptions({
|
|||
},
|
||||
];
|
||||
|
||||
const menuId = useId();
|
||||
|
||||
return (
|
||||
<>
|
||||
<DropdownPopup
|
||||
isOpen={isPopoverActive}
|
||||
setIsOpen={setIsPopoverActive}
|
||||
trigger={
|
||||
<Button
|
||||
<Ariakit.MenuButton
|
||||
id="conversation-menu-button"
|
||||
aria-label="conversation-menu-button"
|
||||
variant="link"
|
||||
className="z-10 h-7 w-7 border-none p-0 transition-all duration-200 ease-in-out"
|
||||
aria-label={localize('com_nav_convo_menu_options')}
|
||||
className={cn(
|
||||
'z-30 inline-flex h-7 w-7 items-center justify-center gap-2 rounded-md border-none p-0 text-sm font-medium transition-all duration-200 ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
|
||||
isActiveConvo === true
|
||||
? 'opacity-100'
|
||||
: 'opacity-0 focus:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100 data-[open]:opacity-100',
|
||||
)}
|
||||
>
|
||||
<Ellipsis className="icon-md text-text-secondary" />
|
||||
</Button>
|
||||
</Ariakit.MenuButton>
|
||||
}
|
||||
items={dropdownItems}
|
||||
className={`${
|
||||
isActiveConvo === true
|
||||
? 'opacity-100'
|
||||
: 'opacity-0 focus:opacity-100 group-hover:opacity-100 data-[open]:opacity-100'
|
||||
}`}
|
||||
menuId={menuId}
|
||||
/>
|
||||
{showShareDialog && (
|
||||
<ShareButton
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue