Open cvrebert opened 8 years ago
I think it also focuses things with tabindex, and presumably any other "focusable areas?" https://www.w3.org/TR/html51/editing.html#focusable
I ran into this because I was trying to find reference to this behaviour:
<div tabindex="-1" onfocus="console.log('div focus')">
<span onclick="document.querySelector('input').focus()">click me</span>
<input onfocus="console.log('input focus')">
</div>
Clicking on the span generates:
div focus
input focus
Related Chrome bug: mousedown from buttons 4 and 5 cause focus and blur
It's not exactly the same because it causes a blur
event (not the same as focusing a form element).
Firefox and Safari do not perform this behavior. But Chrome has it as the default action for the mousedown event which allows devs to call preventDefault
on it.
Refs https://html.spec.whatwg.org/#activation:dom-click-2
Nor is it discussed anywhere else in HTML. UI Events doesn't currently seem to cover this either, but I think it would be the logical place for it.