Im creating examples of things that would cause trouble for keyboard only users. I have an element that I created like this:
<div id="role_tab_div_with_react_onclick_has_keydown" role="tab" onClick={() => activateDialog()} tabIndex="0" onKeyDown={() => activateDialog()}>
<div class="btn-label">Click me (role=tab - has onkeyDown)</div>
</div>
But, when rendered to the DOM, the onKeyDown is not present even thought it is now keyboard activatable.
<div id="role_tab_div_with_react_onclick_has_keydown" role="tab" tabindex="0">
<div class="btn-label">Click me (role=tab - has onkeyDown)</div>
</div>
So, my check to see if the element already has a onkeydown event:
if (el.hasAttribute('onKeyPress' || 'onKeyDown'))
is not finding it.
Is there a way to determine if it does have a react version of onKeyDown present?
Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW
Comments
Post a Comment