Skip to content

Commit

Permalink
fix: react tabs focus styling
Browse files Browse the repository at this point in the history
Closes D2IQ-94906
  • Loading branch information
nataliepina committed Dec 20, 2022
1 parent 405aacf commit 529f226
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"react-focus-lock": "2.9.2",
"react-id-generator": "3.0.2",
"react-popper": "2.3.0",
"react-tabs": "5.1.0",
"react-tabs": "6.0.0",
"react-transition-group": "4.4.5",
"relative-luminance": "2.0.1"
},
Expand Down
13 changes: 10 additions & 3 deletions packages/tabs/components/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,15 @@ injectGlobal`
}
}
.react-tabs__tab:focus {
outline: none;
background: ${themeBgHover}
/* Focusing on tabs with a mouse will not display an outline */
.react-tabs__tab:focus:not(:focus-visible) {
outline: 0;
}
/* Focusing tabs with a keyboard will add a light gray background color */
.react-tabs__tab:focus-visible {
outline: 0;
background-color: ${themeBgHover}
}
.react-tabs__tab--selected {
Expand Down Expand Up @@ -147,6 +153,7 @@ const Tabs = ({
// eslint-disable-next-line @typescript-eslint/no-empty-function
onSelect={onSelect ? onSelect : () => {}}
data-cy="tabs"
focusTabOnClick={false}
>
<TabList>{tabs}</TabList>
{tabsContent}
Expand Down

0 comments on commit 529f226

Please sign in to comment.