Merge pull request #281 from liam-fitzgerald/fix/button-tabindex
Fix tab navigation with indigo react buttons
commitf66e69362920ffe671e59a1927fb4a49093920a4
authorAnthony Arroyo <anthony@tlon.io>
dateWed 18 Sep 2019, 22:57 (7 years ago)
parentc566a0776d1e98
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 {