What can affect keyboard focus html?
I am trying to put together some accessibility examples for work. One of the checkpoints I need to present is key board focus.
I know how assure controls gain keyboard focus, but I can not f开发者_Python百科igure out what would cause a control to be non-focusable.
The only thing I have had success with is using an invalid index for tabIndex. (TabIndex = "-2"). I would prefer not to use this because this is not really an true example of keyboard trap.
I know how to make a field non focusable. What I am trying to find, is something that causes a field to be non focusable unintentionally.
- Explicitly setting it to be outside sequential focus navigation by using a negative number (as per HTML 5)
- Calling
AnHTMLElementNode.blur()
on the target element or an element before it - Calling
AnHTMLElementNode.focus()
in such a way that another element gets the focus as a reaction to something that has to be done to reach the target element in sequential navigation - Using an element that doesn't normally do something (such as a
<span>
) and adding anonclick
event to it.
Just add disabled:
<input type='text' disabled="disabled" />
精彩评论