From 6d252b420e04da1edead0101b49cf8ea07665c08 Mon Sep 17 00:00:00 2001 From: Pinaki Bhattacharjee Date: Mon, 28 Aug 2023 19:32:42 +0530 Subject: [PATCH 1/3] Fix a11y in sidebar Fixes #9162 --- .../theme/DocSidebarItem/Category/index.tsx | 26 +++++++++++++++---- .../locales/ar/theme-common.json | 3 ++- .../locales/base/theme-common.json | 3 ++- .../locales/bn/theme-common.json | 3 ++- .../locales/cs/theme-common.json | 3 ++- .../locales/da/theme-common.json | 3 ++- .../locales/de/theme-common.json | 3 ++- .../locales/es/theme-common.json | 3 ++- .../locales/fa/theme-common.json | 3 ++- .../locales/fil/theme-common.json | 3 ++- .../locales/fr/theme-common.json | 3 ++- .../locales/he/theme-common.json | 3 ++- .../locales/hi/theme-common.json | 3 ++- .../locales/hu/theme-common.json | 3 ++- .../locales/it/theme-common.json | 3 ++- .../locales/ja/theme-common.json | 3 ++- .../locales/ko/theme-common.json | 3 ++- .../locales/nb/theme-common.json | 3 ++- .../locales/nl/theme-common.json | 3 ++- .../locales/pl/theme-common.json | 3 ++- .../locales/pt-BR/theme-common.json | 3 ++- .../locales/pt-PT/theme-common.json | 3 ++- .../locales/ru/theme-common.json | 3 ++- .../locales/sl/theme-common.json | 3 ++- .../locales/sr/theme-common.json | 3 ++- .../locales/sv/theme-common.json | 3 ++- .../locales/tr/theme-common.json | 3 ++- .../locales/uk/theme-common.json | 3 ++- .../locales/vi/theme-common.json | 3 ++- .../locales/zh-Hans/theme-common.json | 3 ++- .../locales/zh-Hant/theme-common.json | 3 ++- 31 files changed, 81 insertions(+), 35 deletions(-) diff --git a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/index.tsx index a3bb2f05d355..bab2fa8def22 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/index.tsx @@ -72,20 +72,35 @@ function useCategoryHrefWithSSRFallback( } function CollapseButton({ + isActive, categoryLabel, onClick, }: { + isActive: boolean; categoryLabel: string; onClick: ComponentProps<'button'>['onClick']; }) { - return ( + return isActive ? ( +