I have a container div whose first child element is another div which acts as a button. The container has one or more additional child elements.
The inner button div is always in the tab order. Our application has a "screen reader mode", and when that is enabled, we also include the outer container div in the tab order. The motivation for this is that we want screen reader users to be able to tab to the whole container, and hear all of the contents read out in order.
The problem is - if the user tabs to the container div and presses the spacebar, the screen reader moves the focus to the child button div, and executes the click action. This happens whether or not the button div has a role of "button". (I'm seeing this happen with JAWS and NVDA. It only happens when the screen reader is running).
Suffice it to say -- we have a complicated UI, and this introduces problems that we'd like to avoid.
Why is this happening? Is there anything I can do to prevent it from happening? I'm open to hacky workarounds.
<div class="container" tabindex="0">
<div role="button" title="tooltip" sys:command="command" tabindex="0">
//Main Content
</div>
<div tabindex=0>
//Secondary Content
</div>
</div>