Skip to content

Commit 6cd8568

Browse files
committed
fix: input and icon button focus
1 parent 092c0a4 commit 6cd8568

File tree

2 files changed

+24
-32
lines changed

2 files changed

+24
-32
lines changed

src/theme/components/icon-button.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@ import { mode } from './../tools';
22

33
const baseStyle = (props: any) => {
44
const { colorScheme } = props;
5+
const colors = props.theme.colors;
56
const focusRing = mode(
67
{
7-
boxShadow: `${colorScheme[400]} 0px 0px 0px 2px`,
8+
outlineWidth: '2px',
9+
outlineColor: `${colors[colorScheme][600]}`,
10+
outlineStyle: 'solid',
811
},
912
{
10-
boxShadow: `${colorScheme[500]} 0px 0px 0px 2px`,
13+
outlineWidth: '2px',
14+
outlineColor: `${colors[colorScheme][500]}`,
15+
outlineStyle: 'solid',
1116
}
1217
)(props);
1318

@@ -30,9 +35,7 @@ const baseStyle = (props: any) => {
3035
borderColor: `${colorScheme}.400`,
3136
},
3237
_focusVisible: {
33-
borderWidth: 2,
3438
_web: {
35-
outlineWidth: '0',
3639
style: { ...focusRing },
3740
},
3841
},

src/theme/components/input.ts

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
1-
import { transparentize } from '../tools';
2-
3-
const baseStyle = () => {
4-
// const { primary } = props.theme.colors;
5-
// Todo: Resolve boxShadow Color or Provide some alternatiove prop for user to change focusRing color
6-
// // Todo: Update to support similar focusRing on iOS , Android and Web
7-
// const focusRing =
8-
// Platform.OS === 'web'
9-
// ? {
10-
// boxShadow:
11-
// props.variant !== 'underlined'
12-
// ? `${primary[400]} 0px 0px 0px 1px`
13-
// : `${primary[400]} 0px 1px 0px 0px`,
14-
// zIndex: 1,
15-
// }
16-
// : {
17-
// // boxShadow: `${useToken('colors', ['primary.400'])} 0px 0px 0px 1px`,
18-
// };
1+
import { transparentize, mode } from '../tools';
192

3+
const baseStyle = (props: any) => {
4+
const { primary } = props.theme.colors;
5+
const focusRing = mode(
6+
{
7+
outlineWidth: '1px',
8+
outlineColor: `${primary[600]}`,
9+
outlineStyle: 'solid',
10+
},
11+
{
12+
outlineWidth: '1px',
13+
outlineColor: `${primary[500]}`,
14+
outlineStyle: 'solid',
15+
}
16+
)(props);
2017
return {
2118
fontFamily: 'body',
2219
py: '2',
@@ -73,11 +70,7 @@ const baseStyle = () => {
7370
// justifyContent: 'space-between',
7471
overflow: 'hidden',
7572
_focus: {
76-
style: {
77-
outlineWidth: '1px',
78-
outlineColor: 'primary.600',
79-
outlineStyle: 'solid',
80-
},
73+
style: { ...focusRing },
8174
},
8275
},
8376
},
@@ -112,11 +105,7 @@ const baseStyle = () => {
112105
// justifyContent: 'space-between',
113106
overflow: 'hidden',
114107
_focus: {
115-
style: {
116-
outlineWidth: '3px',
117-
outlineColor: 'primary.500',
118-
outlineStyle: 'solid',
119-
},
108+
style: { ...focusRing },
120109
},
121110
},
122111
},

0 commit comments

Comments
 (0)