javascript - Angular 带数据触发器 ='focus' 不工作

标签 javascript html angularjs angular-strap

data-trigger 焦点对我不起作用 ...

<span data-content='foo' data-html='true' data-placement='top' data-container='body' data-trigger='focus' bs-popover>

当我点击这个元素时实际上没有发生任何事情。如果我删除 data-trigger='focus' 并将其设置为 hoverclick,它确实有效。

我正在使用 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'>

参见 MDN tabindex source

Plunker - 使用 tabindex 从文档中删除演示

关于javascript - Angular 带数据触发器 ='focus' 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30980923/

相关文章:

javascript - 在firebase中同时更新多个用户

javascript - AngularJS 选项卡集中的 Chart.js 不呈现

javascript - 如何使用 angular2 从 json 对象动态生成 TextFields

javascript - 使用 javascript 创建 html 内容是好是坏

html - 设置相对 div 的宽度不起作用

html - 具有像素尺寸的 div 在不应该时进行换行

angularjs - Angular 1.x $q 到 Angular 2.0 beta

javascript - Amazon Alexa 无法识别号码槽

javascript - 这个 HTML 片段中的 onclick 函数在哪里定义?

javascript - 使用jquery获取json数据