Tab Index And Focus
This demo studies browser focus behavior for plain div elements with unspecified,
negative, zero, and positive tabindex values.
Tab index < 0 - can be focused either by a mouse click, or the focus() function
Tab index >= 0 - can be focused either by a mouse click, or the focus() function, or the tab key, according to its tab order
Tab index unspecified - IE sets it to 0 and can be focused either by a mouse click, or the focus() function
Chrome and Firefox set it to -1 and it can NOT be focused at all
Clicking on a nested div element with unspecified tab-index
IE gives focus always to the child
Chrome and Firefox give focus only to the parent, and only if the parent has its tab-index specified explicitly
Conclusion:
It seems that setting tab-index explicitly to -1 is the best choice when the purpose is to control the focus
either by mouse clicks or by the focus() function.
References: MDN: tabindex, MDN: keyboard-navigable JavaScript widgets