on master help sign in
Fix tab navigation with indigo react buttons
commit76d1e98e3a8981589f8d113d39f6eb266435728b authorLiam Fitzgerald <hastuc-dibtux@gmail.com> dateWed 11 Sep 2019, 17:12 (7 years ago) parent2059fcc
1 file changed+7
src/indigo-react/components/Button.js+7
src/indigo-react/components/Button.js+7
@@ -20,10 +20,17 @@ export default function Button({
2020 children,
2121 ...rest
2222}) {
23+ const handleKeyPress = e => {
24+ if (e.key === 'Enter' && !disabled) {
25+ onClick();
26+ }
27+ };
2328 return (
2429 <Grid
2530 as={As}
2631 gap={1}
32+ tabIndex={!disabled ? 0 : undefined}
33+ onKeyPress={handleKeyPress}
2734 className={cn(
2835 'rel pointer pv4 truncate flex-row justify-between us-none',
2936 {