-
Bug
-
Resolution: Fixed
-
Normal
-
8.0.5
-
None
-
Security Level: Jimmy
-
None
-
None
Test case
http://zkfiddle.org/sample/1mm4ae5/1-IE-popup-activate-bug
put a breakpoint in zul.wgt.Popup.prototype.close() in IE to observer the following:
Debug Info
When executing the follwowing, document.activateElement is always undefined. therefore document.activateElement != n is always true regardless of the current focus location.
if (zk.ff && jq.isAncestor(this.$n(), n)) { jq(n).blur(); } else if (zk.ie && document.activateElement !== n) { zk(n).focus(); }
Root Cause
https://github.com/zkoss/zk/blob/master/zul/src/archive/web/js/zul/wgt/Popup.js#L262
Workaround
for ZK 8.0.5
<script><![CDATA[ zk.afterLoad('zul.wgt', function() { var xPopup = {}; zk.override(zul.wgt.Popup.prototype, xPopup ,{ close: function (opts) { if (this._stackup) this._stackup.style.display = 'none'; // F70-ZK-2007: Clear toggle type. this._shallToggle = false; try { //fix firefox and ie issue if ((zk.ie || zk.ff) && zk.currentFocus) { // Bug ZK-2922, check ancestor first. var n = zk.currentFocus.getInputNode ? zk.currentFocus.getInputNode() : zk.currentFocus.$n(); if (jq.nodeName(n, 'input')) { if (zk.ff && jq.isAncestor(this.$n(), n)) { jq(n).blur(); // trigger a missing blur event. } else if (zk.ie && document.activeElement !== n) { //ZK-3244 popup miss focus on input on IE zk(n).focus(); } } } } catch (e) { // do nothing } this.closeAnima_(opts); // Bug ZK-1124: should pass arguments to closeAnima_ function } });//zk.override });//zk.afterLoad ]]></script>