I thought adding a tabindex to an element which has a “click” event listener on it would make it accessible. I can tab to the element, but pressing Enter does not activate the event listener. What am I missing?
The JS
const pv = document.querySelectorAll(".playVid"),
ib = document.querySelector("#vidbox");
for (let j = 0; j < pv.length; j++) {
pv[j].addEventListener("click", function() {
// stuff goes here
})
};
The HTML
<div class="playVid" data-vid="34" tabindex="0">⏵ Play video</div>