From 12ec64b9880378469b93913ae79cc74ed989a839 Mon Sep 17 00:00:00 2001 From: Dustin Healy <54083382+dustinhealy@users.noreply.github.com> Date: Wed, 21 Jan 2026 10:49:50 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=96=20fix:=20Announce=20Bookmark=20Sel?= =?UTF-8?q?ection=20State=20(#11450)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: bookmarks announce selection state * chore: address Copilot comments --- client/src/common/menus.ts | 2 ++ .../components/Chat/Menus/BookmarkMenu.tsx | 33 ++++++++++++------- .../components/Nav/Bookmarks/BookmarkNav.tsx | 11 ++++++- client/src/locales/en/translation.json | 1 + packages/client/src/common/menus.ts | 2 ++ .../client/src/components/DropdownPopup.tsx | 3 ++ 6 files changed, 40 insertions(+), 12 deletions(-) diff --git a/client/src/common/menus.ts b/client/src/common/menus.ts index 97c2d1b11b..ee7d7292c9 100644 --- a/client/src/common/menus.ts +++ b/client/src/common/menus.ts @@ -15,6 +15,8 @@ export interface MenuItemProps { separate?: boolean; hideOnClick?: boolean; dialog?: React.ReactElement; + ariaLabel?: string; + ariaChecked?: boolean; ref?: React.Ref; className?: string; render?: diff --git a/client/src/components/Chat/Menus/BookmarkMenu.tsx b/client/src/components/Chat/Menus/BookmarkMenu.tsx index bb0dd464c2..ac7b17985e 100644 --- a/client/src/components/Chat/Menus/BookmarkMenu.tsx +++ b/client/src/components/Chat/Menus/BookmarkMenu.tsx @@ -99,6 +99,16 @@ const BookmarkMenu: FC = () => { const newBookmarkRef = useRef(null); + const tagsCount = tags?.length ?? 0; + const hasBookmarks = tagsCount > 0; + + const buttonAriaLabel = useMemo(() => { + if (tagsCount > 0) { + return localize('com_ui_bookmarks_count_selected', { count: tagsCount }); + } + return localize('com_ui_bookmarks_add'); + }, [tagsCount, localize]); + const dropdownItems: t.MenuItemProps[] = useMemo(() => { const items: t.MenuItemProps[] = [ { @@ -114,19 +124,19 @@ const BookmarkMenu: FC = () => { if (data) { for (const tag of data) { - const isSelected = tags?.includes(tag.tag); + const isSelected = tags?.includes(tag.tag) === true; items.push({ id: tag.tag, label: tag.tag, hideOnClick: false, - icon: - isSelected === true ? ( - - ) : ( - - ), + icon: isSelected ? ( + + ) : ( + + ), onClick: () => handleSubmit(tag.tag), disabled: mutation.isLoading, + ariaChecked: isSelected, }); } } @@ -146,10 +156,10 @@ const BookmarkMenu: FC = () => { if (mutation.isLoading) { return ; } - if ((tags?.length ?? 0) > 0) { - return ; + if (hasBookmarks) { + return