Why React doesn't automatically make tag focusable, assign button
aria role and onKeyPress
when adding onClick event handler to the tag? Wouldn't it improve accessibility of the website? I understand that if you use <button>
tag, it will be focusable and have button
aria role by default. However, sometimes you have to use other tags to serve functionality of a button.
I know that you can manually add role=button
, tabindex="0"
, onKeyPress={({keyCode}) => keyCode === 13 ? handleClick()}
, onClick={handleClick}
to the tag but it is too cumbersome.
Am I getting whole accessibility stuff wrong?