Skip to content

Commit

Permalink
Fix focus-visible & button focus (#805)
Browse files Browse the repository at this point in the history
* Fixed missing tabindex

* πŸ› fixed focus-visible not being loaded

* βž– removed rollup polyfill & updated focus-visible
  • Loading branch information
Michael Marszalek authored and vnys committed Nov 13, 2020
1 parent 11d1c3a commit 2b99731
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
3 changes: 1 addition & 2 deletions libraries/core-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
"react": "^16.13.1",
"react-dom": "^16.13.1",
"rollup": "^2.15.0",
"rollup-plugin-polyfill": "^3.0.0",
"rollup-plugin-typescript2": "^0.27.2",
"styled-components": "4.4.1",
"ts-jest": "^26.3.0",
Expand All @@ -84,7 +83,7 @@
"@testing-library/react-hooks": "^3.3.0",
"@types/lodash": "^4.14.162",
"csstype": "^3.0.3",
"focus-visible": "^5.1.0",
"focus-visible": "^5.2.0",
"lodash": "^4.17.19"
},
"engines": {
Expand Down
16 changes: 4 additions & 12 deletions libraries/core-react/pnpm-lock.yaml

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

3 changes: 1 addition & 2 deletions libraries/core-react/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import babel from '@rollup/plugin-babel'
import polyfill from 'rollup-plugin-polyfill'
import typescript from 'rollup-plugin-typescript2'

import pkg from './package.json'
Expand All @@ -22,6 +21,7 @@ export default [
{
input: './src/index.ts',
external: peerDeps,
// : [...peerDeps, 'focus-visible'],
watch: {
clearScreen: true,
include: ['./src/**', './../tokens/**'],
Expand All @@ -37,7 +37,6 @@ export default [
plugins: ['babel-plugin-styled-components'],
}),
commonjs(),
polyfill(['focus-visible']),
],
output: [
{
Expand Down
3 changes: 2 additions & 1 deletion libraries/core-react/src/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
children,
disabled = false,
href,
tabIndex = 0,
...other
},
ref,
Expand All @@ -147,7 +148,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(

const as: ElementType = href ? 'a' : other.as ? other.as : 'button'
const type = href || other.as ? undefined : 'button'
const tabIndex = disabled ? -1 : other.tabIndex
tabIndex = disabled ? -1 : tabIndex

const buttonProps = {
ref,
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'focus-visible'
/* eslint-disable import/prefer-default-export */
export * from './Button'
export * from './Typography'
Expand Down

0 comments on commit 2b99731

Please sign in to comment.