JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<p>
With NVDA <strong>disabled</strong>, when you press enter on this button a count should appear and increment with each keypress. Tabbing onto and off the button also works as do most other key events.
</p>
<p>
With NVDA <strong>enabled</strong>, when you press enter on this button the count will not increment. Tabbing onto and off the button also works as do most other key events.
</p>
<p role="button" tabindex="0">
Press Enter/Click on me
</p>
</div>
<p id="textOutput">
</p>
CSS
p[role=button]{
border: 2px solid blue;
}
JavaScript
var count = 0;
$('p[role=button]').on('click keydown', function(){
if( (event.type == "keydown" && (event.keyCode === 13 || event.keyCode === 32)) || event.type == "click" ){
$('#textOutput').text('Countx: ' + count++ + ', event type: '+event.type);
}
});