mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 09:20:15 +01:00
👐 a11y: Misc. Improvements (#3910)
* fix focus for cancel button in convo delete modal window #3829 * add aria-hidden and aria-label to X and Check svg/button respectively and updated OGDialogClose focus color * update rename, newchat, newchat icon, ConvoOptions icon
This commit is contained in:
parent
9ec665dd2c
commit
b9197f90c6
5 changed files with 11 additions and 7 deletions
|
|
@ -14,6 +14,7 @@ import { useToastContext } from '~/Providers';
|
||||||
import { ConvoOptions } from './ConvoOptions';
|
import { ConvoOptions } from './ConvoOptions';
|
||||||
import { cn } from '~/utils';
|
import { cn } from '~/utils';
|
||||||
import store from '~/store';
|
import store from '~/store';
|
||||||
|
import { useLocalize } from '~/hooks'
|
||||||
|
|
||||||
type KeyEvent = KeyboardEvent<HTMLInputElement>;
|
type KeyEvent = KeyboardEvent<HTMLInputElement>;
|
||||||
|
|
||||||
|
|
@ -44,6 +45,7 @@ export default function Conversation({
|
||||||
const [renaming, setRenaming] = useState(false);
|
const [renaming, setRenaming] = useState(false);
|
||||||
const [isPopoverActive, setIsPopoverActive] = useState(false);
|
const [isPopoverActive, setIsPopoverActive] = useState(false);
|
||||||
const isSmallScreen = useMediaQuery('(max-width: 768px)');
|
const isSmallScreen = useMediaQuery('(max-width: 768px)');
|
||||||
|
const localize = useLocalize();
|
||||||
|
|
||||||
const clickHandler = async (event: MouseEvent<HTMLAnchorElement>) => {
|
const clickHandler = async (event: MouseEvent<HTMLAnchorElement>) => {
|
||||||
if (event.button === 0 && (event.ctrlKey || event.metaKey)) {
|
if (event.button === 0 && (event.ctrlKey || event.metaKey)) {
|
||||||
|
|
@ -146,13 +148,14 @@ export default function Conversation({
|
||||||
value={titleInput ?? ''}
|
value={titleInput ?? ''}
|
||||||
onChange={(e) => setTitleInput(e.target.value)}
|
onChange={(e) => setTitleInput(e.target.value)}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
|
aria-label={`${localize('com_ui_rename')} ${localize('com_ui_chat')}`}
|
||||||
/>
|
/>
|
||||||
<div className="flex gap-1">
|
<div className="flex gap-1">
|
||||||
<button onClick={cancelRename}>
|
<button onClick={cancelRename} aria-label='cancel new name'>
|
||||||
<X className="transition-colors h-4 w-4 duration-200 ease-in-out hover:opacity-70" />
|
<X aria-hidden={true} className="transition-colors h-4 w-4 duration-200 ease-in-out hover:opacity-70" />
|
||||||
</button>
|
</button>
|
||||||
<button onClick={onRename}>
|
<button onClick={onRename} aria-label='submit new name'>
|
||||||
<Check className="transition-colors h-4 w-4 duration-200 ease-in-out hover:opacity-70" />
|
<Check aria-hidden={true} className="transition-colors h-4 w-4 duration-200 ease-in-out hover:opacity-70" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ export default function ConvoOptions({
|
||||||
: 'opacity-0 focus:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100 data-[open]: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" />
|
<Ellipsis className="icon-md text-text-secondary" aria-hidden={true}/>
|
||||||
</Ariakit.MenuButton>
|
</Ariakit.MenuButton>
|
||||||
}
|
}
|
||||||
items={dropdownItems}
|
items={dropdownItems}
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ export default function NewChat({
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<button
|
<button
|
||||||
id="nav-new-chat-btn"
|
id="nav-new-chat-btn"
|
||||||
aria-label="nav-new-chat-btn"
|
aria-label={localize('com_ui_new_chat')}
|
||||||
className="text-text-primary"
|
className="text-text-primary"
|
||||||
>
|
>
|
||||||
<NewChatIcon className="size-5" />
|
<NewChatIcon className="size-5" />
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ export default function NewChatIcon({ className = '' }: { className?: string })
|
||||||
fill="none"
|
fill="none"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
className={cn('text-black dark:text-white', className)}
|
className={cn('text-black dark:text-white', className)}
|
||||||
|
aria-hidden={true}
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
fillRule="evenodd"
|
fillRule="evenodd"
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ const OGDialogTemplate = forwardRef((props: DialogTemplateProps, ref: Ref<HTMLDi
|
||||||
<div>{leftButtons ? leftButtons : null}</div>
|
<div>{leftButtons ? leftButtons : null}</div>
|
||||||
<div className="flex h-auto gap-3">
|
<div className="flex h-auto gap-3">
|
||||||
{showCancelButton && (
|
{showCancelButton && (
|
||||||
<OGDialogClose className="btn btn-neutral border-token-border-light relative rounded-lg text-sm">
|
<OGDialogClose className="btn btn-neutral border-token-border-light relative rounded-lg text-sm ring-offset-2 dark:ring-offset-0 focus:ring-2 focus:ring-black">
|
||||||
{Cancel}
|
{Cancel}
|
||||||
</OGDialogClose>
|
</OGDialogClose>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue