When i select a value in a dropdown using keyboard and then press tab is focusing the first field in the form.
当我使用键盘在下拉菜单中选择一个值,然后按tab键,就会聚焦表单中的第一个字段。
This is a bug in bootstrap framework i guess.
我想这是bootstrap框架中的一个bug。
Jsfiddle
http://getbootstrap.com/javascript/#dropdowns
引导页面链接
2 个解决方案
#1
0
In bootstrap the dropdown elements are not select
elements but are buttons
which happen to have dropdown functionality. So they behave like buttons and lose focus when they are clicked. you may have to enforce the focus retention yourself.
在bootstrap中,下拉元素不是选择元素,而是恰好有下拉功能的按钮。所以它们的行为就像按钮一样,当它们被点击时就会失去焦点。你可能必须强迫自己保持专注。
You can enforce the focus on change of value so that the default bootstrap behaviour is over-ridden
您可以加强对值更改的关注,这样默认的引导行为就会被覆盖
$("#dropdownMenu2 button").focus();
See fiddle: http://jsfiddle.net/qwovd1xv/
看到小提琴:http://jsfiddle.net/qwovd1xv/
#2
0
Why not use a regular <select>
element? The tabbing works now. Also, you should wrap your form in an actual <form>
element.
为什么不使用常规的
http://jsfiddle.net/5p341amh/245/
http://jsfiddle.net/5p341amh/245/
#1
0
In bootstrap the dropdown elements are not select
elements but are buttons
which happen to have dropdown functionality. So they behave like buttons and lose focus when they are clicked. you may have to enforce the focus retention yourself.
在bootstrap中,下拉元素不是选择元素,而是恰好有下拉功能的按钮。所以它们的行为就像按钮一样,当它们被点击时就会失去焦点。你可能必须强迫自己保持专注。
You can enforce the focus on change of value so that the default bootstrap behaviour is over-ridden
您可以加强对值更改的关注,这样默认的引导行为就会被覆盖
$("#dropdownMenu2 button").focus();
See fiddle: http://jsfiddle.net/qwovd1xv/
看到小提琴:http://jsfiddle.net/qwovd1xv/
#2
0
Why not use a regular <select>
element? The tabbing works now. Also, you should wrap your form in an actual <form>
element.
为什么不使用常规的
http://jsfiddle.net/5p341amh/245/
http://jsfiddle.net/5p341amh/245/