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

Browsers supporting both touch and mouse fails to register mouse events following ZK-4301

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 9.5.1.2, 9.6.0
    • 9.5.1, 9.5.1.1
    • Components
    • Security Level: Jimmy
    • A desktop browser with touch-support

    • None

      Steps to Reproduce

      Set browser agent to a mobile agent in Chrome developer tools > "..." menu > more tools > network conditions tab.

      This will cause the browser to load the domtouch.js (touch events handling) while the browser has also mouse events.

      NOTE: this is an incorrect use of browser user agent BUT it's the easy way to reproduce the conditions on a hybrid device such as a "Surface" PC tablet, or a windows 10 desktop using a touch-enabled monitor with the win10 touch driver.

       

      Open fiddle:

      https://zkfiddle.org/sample/3u27amp/1-Another-new-ZK-fiddle

      Click button to open modal window

      Drag mobile window

      Current Result

      Mouse cannot drag the modal window (touch events may drag)

      Expected Result

      Both mouse and touch should be registered

      Debug Information

      https://tracker.zkoss.org/browse/ZK-4301

       

      Event types are defined in dom.js

      https://github.com/zkoss/zk/blob/0efb2dbfa21ebf2cbec4b601375d1e1037000ed0/zk/src/archive/web/js/zk/dom.ts#L297-L303

      domtouch.js replaces the original entries for 3 events (mousemove, mouseup, mousedown) buy their touch equivalent. However, since they replace them using the same event key (zmousemove, zmouseup, zmousedown), the original mouse events are removed from the event types.

      https://github.com/zkoss/zk/blob/master/zk/src/archive/web/js/zk/domtouch.js#L95-L99

      https://developer.mozilla.org/en-US/docs/Web/API/Touch_events/Supporting_both_TouchEvent_and_MouseEvent

      Workaround

      full replacement file for domtouch.js (Ask support team)

       

            rudyhuang rudyhuang
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 3 days
                3d
                Remaining:
                Time Spent - 1 day, 1 hour Remaining Estimate - 1 day, 7 hours
                1d 7h
                Logged:
                Time Spent - 1 day, 1 hour Remaining Estimate - 1 day, 7 hours
                1d 1h