Sep 4, 2018 · 1 min read
Also, If you like to have focus on keyboard-tab, but not onClick you can wrap the inner contents of your element as below:
<button onClick={() => foo()}>
<span
style={{
outline: 'none',
width: '100%',
height: '100%',
}}
tabIndex='-1' // makes span element un-tabbable
>
Submit
</span>
</button>So when you tab, you will tab to the <button/>, but when you click you will be clicking on the <span />.
