diff --git a/.changeset/tricky-planets-drum.md b/.changeset/tricky-planets-drum.md new file mode 100644 index 00000000000..1fab6ec44e7 --- /dev/null +++ b/.changeset/tricky-planets-drum.md @@ -0,0 +1,5 @@ +--- +'@primer/react': minor +--- + +Remove support for focus-visible polyfill diff --git a/@types/focus-visible/index.d.ts b/@types/focus-visible/index.d.ts deleted file mode 100644 index 9324650874f..00000000000 --- a/@types/focus-visible/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module 'focus-visible' diff --git a/package-lock.json b/package-lock.json index 4dbc6c7c7c5..c88bfa8bafe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,6 @@ "clsx": "^1.2.1", "color2k": "^2.0.3", "deepmerge": "^4.2.2", - "focus-visible": "^5.2.0", "fzy.js": "^0.4.1", "history": "^5.0.0", "lodash.isempty": "^4.4.0", @@ -8153,19 +8152,6 @@ "node": ">= 8" } }, - "node_modules/@storybook/addon-highlight": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/@storybook/addon-highlight/-/addon-highlight-7.6.2.tgz", - "integrity": "sha512-HjV/DPUaBtH4HWc2zeZE3Oo8qQ7IWscpsYSa2NvflaMSHw3qaskfBLq60QVvodCvxlxaoQe3GfXx+eNg4mvaBw==", - "dev": true, - "dependencies": { - "@storybook/global": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - } - }, "node_modules/@storybook/addon-interactions": { "version": "7.6.4", "resolved": "https://registry.npmjs.org/@storybook/addon-interactions/-/addon-interactions-7.6.4.tgz", @@ -22608,11 +22594,6 @@ "node": ">=0.4.0" } }, - "node_modules/focus-visible": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/focus-visible/-/focus-visible-5.2.0.tgz", - "integrity": "sha512-Rwix9pBtC1Nuy5wysTmKy+UjbDJpIfg8eHjw0rjZ1mX4GNLz1Bmd16uDpI3Gk1i70Fgcs8Csg2lPm8HULFg9DQ==" - }, "node_modules/follow-redirects": { "version": "1.15.4", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", diff --git a/package.json b/package.json index 3c4a10d6137..0ebde3180d8 100644 --- a/package.json +++ b/package.json @@ -114,7 +114,6 @@ "clsx": "^1.2.1", "color2k": "^2.0.3", "deepmerge": "^4.2.2", - "focus-visible": "^5.2.0", "fzy.js": "^0.4.1", "history": "^5.0.0", "lodash.isempty": "^4.4.0", diff --git a/src/BaseStyles.tsx b/src/BaseStyles.tsx index aece80f6087..af8947fc9f0 100644 --- a/src/BaseStyles.tsx +++ b/src/BaseStyles.tsx @@ -4,26 +4,23 @@ import {COMMON, SystemCommonProps, SystemTypographyProps, TYPOGRAPHY} from './co import {useTheme} from './ThemeProvider' import {ComponentProps} from './utils/types' -// load polyfill for :focus-visible -import 'focus-visible' - const GlobalStyle = createGlobalStyle<{colorScheme?: 'light' | 'dark'}>` * { box-sizing: border-box; } body { margin: 0; } table { border-collapse: collapse; } input { color-scheme: ${props => props.colorScheme}; } - [role="button"]:focus:not(:focus-visible):not(.focus-visible), - [role="tabpanel"][tabindex="0"]:focus:not(:focus-visible):not(.focus-visible), - button:focus:not(:focus-visible):not(.focus-visible), - summary:focus:not(:focus-visible):not(.focus-visible), - a:focus:not(:focus-visible):not(.focus-visible) { + [role="button"]:focus:not(:focus-visible) + [role="tabpanel"][tabindex="0"]:focus:not(:focus-visible) + button:focus:not(:focus-visible), + summary:focus:not(:focus-visible), + a:focus:not(:focus-visible) { outline: none; box-shadow: none; } - [tabindex="0"]:focus:not(:focus-visible):not(.focus-visible), - details-dialog:focus:not(:focus-visible):not(.focus-visible) { + [tabindex="0"]:focus:not(:focus-visible), + details-dialog:focus:not(:focus-visible) { outline: none; } ` diff --git a/src/TreeView/TreeView.tsx b/src/TreeView/TreeView.tsx index 4a1bcd94d83..460bc55f98a 100644 --- a/src/TreeView/TreeView.tsx +++ b/src/TreeView/TreeView.tsx @@ -87,8 +87,7 @@ const UlBox = styled.ul` .PRIVATE_TreeView-item { outline: none; - &:focus-visible > div, - &.focus-visible > div { + &:focus-visible > div { box-shadow: inset 0 0 0 2px ${get(`colors.accent.fg`)}; @media (forced-colors: active) { outline: 2px solid HighlightText;