html table element focus on mouse click
If give a html table element a tabIndex > 0 then I can tab into that element. If I click on a table element where tabIndex > 0 then I would expect the focus to change to that elemen开发者_JAVA百科t. But in IE it doesn't seem to do it while in Firefox and Chome it does.
If I do the same with a div element then this does focus on mouse click in IE, Firefox and Chrome.
So it seems that IE doesn't automatically focus a table element on mouse click.
Can anyone confirm this? Also is there a workaround? I could capture the mouse click and call focus myself, but IE seems to try and center the element on the screen when focus is called. This looks bad in my app.
Thanks,
AJ
Check out this article: http://nemisj.com/focusable/
Basically, the browsers all differently implement focus on traditionally "non-focusable" elements. With IE, you can use a click event instead (using conditional code and browser detection), or implement one of the workarounds suggested in the linked article.
精彩评论