From d6358db341b5700483107dd8d189430db097118a Mon Sep 17 00:00:00 2001 From: m7kvqbe1 Date: Wed, 15 Jul 2020 10:57:42 +0100 Subject: [PATCH] feat(TabSet): Set `tabIndex` and `aria-hidden` based on active --- .../src/components/TabSet/TabContent.tsx | 2 + .../src/components/TabSet/TabItem.tsx | 1 + .../src/components/TabSet/TabSet.test.tsx | 48 +++++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/packages/react-component-library/src/components/TabSet/TabContent.tsx b/packages/react-component-library/src/components/TabSet/TabContent.tsx index a24af8ac71..1ccc856c12 100644 --- a/packages/react-component-library/src/components/TabSet/TabContent.tsx +++ b/packages/react-component-library/src/components/TabSet/TabContent.tsx @@ -21,6 +21,8 @@ export const TabContent: React.FC = ({ className={classes} role="tabpanel" aria-labelledby={tabId} + aria-hidden={!isActive} + tabIndex={0} data-testid="content" > {children} diff --git a/packages/react-component-library/src/components/TabSet/TabItem.tsx b/packages/react-component-library/src/components/TabSet/TabItem.tsx index 1222c1e4f9..ef86cd9611 100644 --- a/packages/react-component-library/src/components/TabSet/TabItem.tsx +++ b/packages/react-component-library/src/components/TabSet/TabItem.tsx @@ -29,6 +29,7 @@ export const TabItem = forwardRef( role="tab" aria-controls={tabId} aria-selected={!!isActive} + tabIndex={!isActive ? -1 : 0} >