Disable ugly focus

pull/1331/head
Kamran Ahmed 3 years ago
parent 170b14df4c
commit eafbcd5867
  1. 11
      package-lock.json
  2. 3
      package.json
  3. 17
      pages/_app.tsx
  4. 5
      yarn.lock

11
package-lock.json generated

@ -19,6 +19,7 @@
"@next/mdx": "^11.1.0", "@next/mdx": "^11.1.0",
"@svgr/webpack": "^5.5.0", "@svgr/webpack": "^5.5.0",
"date-fns": "^2.23.0", "date-fns": "^2.23.0",
"focus-visible": "^5.2.0",
"framer-motion": "^4.1.17", "framer-motion": "^4.1.17",
"next": "^11.1.0", "next": "^11.1.0",
"prism-themes": "^1.8.0", "prism-themes": "^1.8.0",
@ -6408,6 +6409,11 @@
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
}, },
"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/foreach": { "node_modules/foreach": {
"version": "2.0.5", "version": "2.0.5",
"resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz",
@ -16274,6 +16280,11 @@
} }
} }
}, },
"focus-visible": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/focus-visible/-/focus-visible-5.2.0.tgz",
"integrity": "sha512-Rwix9pBtC1Nuy5wysTmKy+UjbDJpIfg8eHjw0rjZ1mX4GNLz1Bmd16uDpI3Gk1i70Fgcs8Csg2lPm8HULFg9DQ=="
},
"foreach": { "foreach": {
"version": "2.0.5", "version": "2.0.5",
"resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz",

@ -25,6 +25,7 @@
"@next/mdx": "^11.1.0", "@next/mdx": "^11.1.0",
"@svgr/webpack": "^5.5.0", "@svgr/webpack": "^5.5.0",
"date-fns": "^2.23.0", "date-fns": "^2.23.0",
"focus-visible": "^5.2.0",
"framer-motion": "^4.1.17", "framer-motion": "^4.1.17",
"next": "^11.1.0", "next": "^11.1.0",
"prism-themes": "^1.8.0", "prism-themes": "^1.8.0",
@ -34,6 +35,8 @@
}, },
"devDependencies": { "devDependencies": {
"@types/eslint": "7.28.0", "@types/eslint": "7.28.0",
"@types/gh-pages": "^3.2.0",
"@types/glob": "^7.1.4",
"@types/react": "17.0.16", "@types/react": "17.0.16",
"@types/react-dom": "17.0.2", "@types/react-dom": "17.0.2",
"@types/styled-components": "^5.1.12", "@types/styled-components": "^5.1.12",

@ -1,12 +1,28 @@
import { useEffect } from 'react'; import { useEffect } from 'react';
import type { AppProps } from 'next/app'; import type { AppProps } from 'next/app';
import { ChakraProvider } from '@chakra-ui/react'; import { ChakraProvider } from '@chakra-ui/react';
import { Global, css } from '@emotion/react';
import 'prism-themes/themes/prism-shades-of-purple.css'; import 'prism-themes/themes/prism-shades-of-purple.css';
import 'focus-visible/dist/focus-visible';
import { roadmapTheme } from '../styles/theme'; import { roadmapTheme } from '../styles/theme';
import { firePageView } from '../lib/gtag'; import { firePageView } from '../lib/gtag';
import '../styles/carbon.css'; import '../styles/carbon.css';
import { StickyBanner } from '../components/sticky-banner'; import { StickyBanner } from '../components/sticky-banner';
const GlobalStyles = css`
/*
This will hide the focus indicator if the
element receives focus via the mouse,
but it will still show up on keyboard focus.
*/
.js-focus-visible :focus:not([data-focus-visible-added]) {
outline: none;
box-shadow: none;
}
`;
function MyApp({ Component, pageProps }: AppProps) { function MyApp({ Component, pageProps }: AppProps) {
useEffect(() => { useEffect(() => {
firePageView(window.location.pathname); firePageView(window.location.pathname);
@ -14,6 +30,7 @@ function MyApp({ Component, pageProps }: AppProps) {
return ( return (
<ChakraProvider theme={roadmapTheme}> <ChakraProvider theme={roadmapTheme}>
<Global styles={GlobalStyles} />
<StickyBanner /> <StickyBanner />
<Component {...pageProps} /> <Component {...pageProps} />
</ChakraProvider> </ChakraProvider>

@ -3879,6 +3879,11 @@
dependencies: dependencies:
"tslib" "^1.9.3" "tslib" "^1.9.3"
"focus-visible@^5.2.0":
"integrity" "sha512-Rwix9pBtC1Nuy5wysTmKy+UjbDJpIfg8eHjw0rjZ1mX4GNLz1Bmd16uDpI3Gk1i70Fgcs8Csg2lPm8HULFg9DQ=="
"resolved" "https://registry.npmjs.org/focus-visible/-/focus-visible-5.2.0.tgz"
"version" "5.2.0"
"foreach@^2.0.5": "foreach@^2.0.5":
"integrity" "sha1-C+4AUBiusmDQo6865ljdATbsG5k=" "integrity" "sha1-C+4AUBiusmDQo6865ljdATbsG5k="
"resolved" "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz" "resolved" "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz"

Loading…
Cancel
Save