问题描述
Bootstrap 3中的tabindex
属性有什么用?
尽管他们实际上在所有模态中都使用它们,但其文档中没有提及任何内容.
我只是发现了它的用途,并没有说太多
我发现如果属性不是-1
.
来源: http://webaim.org/techniques/keyboard/tabindex
这就是为什么在模态<div>
上需要tabindex="-1"
的原因,以便用户可以访问常见的鼠标和键盘快捷键.希望有帮助.
What's the tabindex
attribute in Bootstrap 3 for?
Its documentation doesn't say anything about them although they use them practically in all modals.
I've only find this regarding its use, which doesn't really say much
And I found out I can't press esc
to hide a modal if the tabindex
attribute is not -1
.
- Modal closing after pressing
esc
key (with tabindex) - Modal not closing after pressing
esc
key (without tabindex)
Source: http://webaim.org/techniques/keyboard/tabindex
This is why you need tabindex="-1"
on the modal <div>
, so users can access common mouse and keyboard shortcuts. Hope that helps.
这篇关于什么是tabindex =“-1"?在引导中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!