[英]NgBlur not firing in Internet explorer
I have a simple dropdown which shows when a button is clicked and hides when a button in dropdown is clicked or user click everywhere else on the page. 我有一个简单的下拉列表,显示单击按钮时的效果,并在单击下拉列表中的按钮或用户单击页面上的其他位置时隐藏。 Code is working in chrome but not in IE.
代码正在使用chrome但不在IE中。 It is looking like
ng-blur
event on the section
is never firing in ie 它看起来像该
section
ng-blur
事件永远不会发射ie
I'm using IE11 and AngularJS 1.2.3. 我正在使用IE11和AngularJS 1.2.3。 Code is working fine in Chrome.
代码在Chrome中正常运行。
// some other html here
<section tabindex="0" ng-blur="menu.isOpen=false"> // main section
<div ng-click="toggle()">
<div>button</div> //button opening dropdown
</div>
<div ng-show="menu.isOpen">
<div>
<ul>
<li name="Sign Off" ng-click="toggle()">Sign off</li>
</ul>
</div>
</div>
</section>
// here rest of page
toggle() method is simple: toggle()方法很简单:
menu.isOpen=!menu.isOpen;
UPDATE: 更新:
after even more investigation I know that that section
never get focus so it never get blur. 经过更多调查后,我知道该
section
永远不会聚焦,所以它永远不会变得模糊。 It is somehow hidden under the divs inside him. 它以某种方式隐藏在他内心的div之下。 Setting
z-index:1500
didn't helped. 设置
z-index:1500
没有帮助。
According to angularjs source code, ng-blur is meant to be used on the following elements: 根据angularjs源代码,ng-blur意在用于以下元素:
window, input, select, textarea, a
窗口,输入,选择,textarea,a
Maybe you could replace 'section' by 'a' and try again in ie11? 也许你可以用'a'替换'section'并在ie11再试一次?
The 'a' css can be configured with a style attribute. 'a'css可以配置样式属性。
Tabinidex should solve the issue. Tabinidex应该解决这个问题。 For it to work, every element that contains the tabindex attribute should have a secuential unique number greather than 0.
要使其工作,包含tabindex属性的每个元素都应具有比0更大的secuential唯一编号。
In your case I will assume is not working due to you are using tabindex=0. 在你的情况下,由于你使用tabindex = 0,我将假设不起作用。 If you switch it to 1 it may work if you don´t have other element with tabindex=1 anywhere else in the code.
如果将其切换为1,如果您在代码中的其他位置没有tabindex = 1的其他元素,则它可能会起作用。
We faced the same issue, and what worked for us was to use the tabindex attribute as 1 in the body, and removing all tabindex attributes from our elements containing ng-blur. 我们面临同样的问题,对我们有用的是在主体中使用tabindex属性为1,并从包含ng-blur的元素中删除所有tabindex属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.