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

missing context menu after ZK-4835 on hybrid mouse / touch devices

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 9.6.4
    • 9.6.3
    • None
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      Run fiddle
      https://zkfiddle.org/sample/1r2e975/2-missing-context-menu-after-ZK-4835

      Run on chrome, on a device with both mouse and touch screen.
      Alternatively, use chrome dev. tools sensor panel to force touch API enabling.

      Long press on one of the labels

      Current Result

      Context popup doesn't open.

      Expected Result

      context popup opens at mouse position

      Debug Information

      In zk.Widget.prototype.bind_, the touch workflows (bindSwipe, bindDoubleTap, bindTapHold) are only triggered if zk.mobile is true.
      zk.mobile is only true on tablet / cellphone, not on laptop with touch screen.

      Updated Workaround

      updated: use different entrypoint

      <script><![CDATA[ 
              zk.afterLoad("zk", function () {
                  var _xWidget = {};
                  zk.override(zk.Widget.prototype, _xWidget, {
                      bind_: function bind_(desktop, skipper, after) {
                          _xWidget.bind_.apply(this, arguments);
                          if (zk.touchEnabled && !zk.mobile) {
      					  var self = this;
                            after.push(function () {
                              setTimeout(function () {
                                self.bindSwipe_();
                                self.bindDoubleTap_();
                                self.bindTapHold_();
                              }, 300);
                            });
                          }
                      },
      	        	_tapHoldStart: function _tapHoldStart(evt) {
      	        	  _xWidget._tapHoldStart.apply(this, arguments);
      	        	  if(evt.touches.length){
      	        		  zk.currentPointer = [evt.touches[0].clientX,evt.touches[0].clientY];
      	        	  }
                     }
                   });
              });
          ]]></script>
      

            DevChu DevChu
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: