I can't set the focus on the input box through the 'mousedown' event from the canvas but I can do this with 'mouseup', why is that the case? Is this browser specific?(using chrome)
var canvas = document.getElementById('can');
canvas.addEventListener('mousedown', (e)=>{
document.getElementById('box').focus();
})
<canvas id="can"></canvas>
<input type="text" id="box"></input>
var canvas = document.getElementById('can');
canvas.addEventListener('mouseup', (e)=>{
document.getElementById('box').focus();
})
<canvas id="can"></canvas>
<input type="text" id="box"></input>
I have also fooled around with tabindex(tabindex='-1','0' or '1') but that doesn't work either for mousedown. So is my only option to use mouseup for this event?