I built a drag and drop component, and it works like a charm, but now I need to make it accessible for screen reader users.
I already have the implementation of the solution done. Basically its a context menu that pops when the enter is pressed and allow to move things around.
This works like a charm when navigating without the SR (screen reader), because the implementation that I made listen to KeyEvents (keypress and keydown).
The problem is when using the SR (I tested with NVDA), the keyevents are not triggered, instead it goes to the click event (Which is part of drag and drop, not meant for non-visual users)
Changing the role
attribute to application
works, but other shortcuts from the SR doesn't.
Is there a reliable way to detect if the click event was triggered by the SR ? Or some other keyboard event that I can listen that is triggered when SR is turned on ?
There is already a question like this on SO, but is unanswered.
Edit1: Adding HTML structure information
<div>
<img src="some-image.jpg" aria-hidden="true">
<div class="card-container" (click)="cardClicked($event)" (keypress)="showContextMenu($event)">
<span>Card name</span>
</div>
</div>