Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3661

typo in popup.js after ZK-3244

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 8.0.5
    • Fix Version/s: 8.5.0
    • Component/s: None
    • Security Level: Jimmy
    • Labels:
      None

      Description

      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>
      

        Attachments

          Activity

            People

            Assignee:
            DevChu DevChu
            Reporter:
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 10 minutes
                10m