From 55ac8d5793915caf4963ffa0847c50ac3946e96c Mon Sep 17 00:00:00 2001 From: Scott Dickerson <6663002+scottdickerson@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:22:25 -0600 Subject: [PATCH] fix(tabpanel): was hiding the panel info from screen readers --- src/components/Tabs/Tabs.test.tsx | 4 ++++ src/components/Tabs/TabsContent.tsx | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/Tabs/Tabs.test.tsx b/src/components/Tabs/Tabs.test.tsx index 629d54d0..d4c97f61 100644 --- a/src/components/Tabs/Tabs.test.tsx +++ b/src/components/Tabs/Tabs.test.tsx @@ -27,6 +27,8 @@ describe('Tabs', () => { // Verify default tab content is visible expect(screen.getByText('Overview content')).toBeVisible(); + expect(screen.getByRole('tabpanel', { name: 'Overview' })).toBeInTheDocument(); + expect(screen.queryByRole('tabpanel', { name: 'Browse lots' })).not.toBeInTheDocument(); }); test('renders ReactNode in tab', () => { const componentTabs = [ @@ -66,6 +68,8 @@ describe('Tabs', () => { await userEvent.click(screen.getByRole('tab', { name: /Browse/i })); expect(screen.getByText('Browse lots content')).toBeVisible(); + expect(screen.getByRole('tabpanel', { name: 'Browse lots' })).toBeInTheDocument(); + expect(screen.queryByRole('tabpanel', { name: 'Overview' })).not.toBeInTheDocument(); }); test('calls onTabClick when a tab is clicked', async () => { const onTabClickMock = vitest.fn(); diff --git a/src/components/Tabs/TabsContent.tsx b/src/components/Tabs/TabsContent.tsx index 3f176929..1420aa20 100644 --- a/src/components/Tabs/TabsContent.tsx +++ b/src/components/Tabs/TabsContent.tsx @@ -36,7 +36,6 @@ const TabsContent = forwardRef( {...commonProps} ref={ref} tabIndex={-1} - aria-hidden > {children}