Why tabindex='-1' prevents keyboard

2019-07-03 22:08发布

After many hours trying to locate why a keyboard input would not work within a bootstrap modal, i have finally managed to identify the issue.. and it was something i would have never of thought of, but found it by pure process of elimination.

By having tabindex='-1' present on the <div> for the modal from bootstrap, it completely stops the input from the keyboard. I would have thought the data-attribute data-keyboard="false" would have been the culprit however it was not.

My Question Why does tabindex='-1' prevent keyboard input. And what would be its purpose other than that?

1条回答
▲ chillily
2楼-- · 2019-07-03 22:32

tabindex sets the order that editable-elements on the page will be iterated using the tab key. -1 seems like a reasonable value, from that sense, to make an element unapproachable.

For more information: http://webaim.org/techniques/keyboard/tabindex

查看更多
登录 后发表回答