data-trigger
焦点对我不起作用 ...
<span data-content='foo' data-html='true' data-placement='top' data-container='body' data-trigger='focus' bs-popover>
当我点击这个元素时实际上没有发生任何事情。如果我删除 data-trigger='focus'
并将其设置为 hover
或 click
,它确实有效。
我正在使用 angularjs。 1.2.18 和 Angular 带:2.2.4
最佳答案
您可以添加 tabindex
制作 <span>
的属性可聚焦。这也适用于 <div>
和 <table>
元素。
The tabindex global attribute is an integer indicating if the element can take input focus (is focusable), if it should participate to sequential keyboard navigation, and if so, at what position. It can takes several values:
- a negative value means that the element should be focusable, but should not be reachable via sequential keyboard navigation;
- 0 means that the element should be focusable and reachable via sequential keyboard navigation, but its relative order is defined by the platform convention;
- a positive value which means should be focusable and reachable via sequential keyboard navigation; its relative order is defined by the value of the attribute: the sequential follow the increasing number of the tabindex. If several elements share the same tabindex, their relative order follows their relative position in the
观察标记的以下变化...
<span data-content='foo'
data-html='true'
data-placement='top'
data-container='body'
data-trigger='focus'
bs-popover
tabindex='0'>
Plunker - 使用 tabindex
从文档中删除演示
关于javascript - Angular 带数据触发器 ='focus' 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30980923/