<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>202143</bug_id>
          
          <creation_ts>2019-09-24 07:40:48 -0700</creation_ts>
          <short_desc>[iOS] iOS 13 does not send proper events in Safari, such as double tap and long touch, possibly​ influencing Leaflet JS apps​</short_desc>
          <delta_ts>2019-10-01 00:43:03 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>UI Events</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>iPhone / iPad</rep_platform>
          <op_sys>Other</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tomas Slavkovsky">tomas.slavkovsky</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>graouts</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1573653</commentid>
    <comment_count>0</comment_count>
    <who name="Tomas Slavkovsky">tomas.slavkovsky</who>
    <bug_when>2019-09-24 07:40:48 -0700</bug_when>
    <thetext>Long tap in iOS 13 Safari does not send any event to the Leaflet library and is handled by iOS itself.

Double click emits following events: mouseover, mousemove, mousedown, mouseup, click, which results in leaflet&apos;s event click.

Might be tested on test map on https://leafletjs.com, if you use long-press it will trigger the copy-paste. Double click does not trigger anything. 

https://github.com/Leaflet/Leaflet/issues/6817#issue-497034089</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1574251</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2019-09-25 15:37:20 -0700</bug_when>
    <thetext>&lt;rdar://problem/55721808&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1575246</commentid>
    <comment_count>2</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2019-09-30 06:18:28 -0700</bug_when>
    <thetext>The change in behavior seems tied to the availability of Pointer Events in iOS 13.

With Pointer Events enabled (the default setting):

- double-tap: nothing happens
- long press: plus icon gets selected

With Pointer Events disabled (Settings &gt; Safari &gt; Advanced &gt; Experimental Features &gt; Pointer Events set to off):

- double-tap: map zooms to tapped location
- long press: nothing happens

Both of those behaviors match those of iOS 12.4.1 so Pointer Events introduced a regression for LeafletJS.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1575250</commentid>
    <comment_count>3</comment_count>
      <attachid>379833</attachid>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2019-09-30 06:43:43 -0700</bug_when>
    <thetext>Created attachment 379833
Leaflet test

Attached a simple test case for LeafletJS which includes the full JS source which may make it easier to diagnose issues.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1575254</commentid>
    <comment_count>4</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2019-09-30 07:13:19 -0700</bug_when>
    <thetext>So, first, the &quot;contextmenu&quot; Leaflet event is not triggered because the Leaflet code uses &quot;pointerdown&quot; and &quot;touchstart&quot; events interchangeably and the availability of the former excludes the other. In Map.Tap.js the `_onDown` method has this check `if (!e.touches) { return; }` which will always lead to an early return since a PointerEvent event is not the same as a TouchEvent and does not have a `touches` property.

So the lack of a Leaflet &quot;contextmenu&quot; event being triggered is a Leaflet issue specifically.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1575255</commentid>
    <comment_count>5</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2019-09-30 07:31:24 -0700</bug_when>
    <thetext>Actually, the &quot;contextmenu&quot;-related code is never initialized because Leaflet only enables it if touch events are supported but pointer events aren&apos;t:

    if (Browser.touch &amp;&amp; !Browser.pointer) {
    	Map.addInitHook(&apos;addHandler&apos;, &apos;tap&apos;, Tap);
    }

This makes sense since the code up there is specific to touch events. This code is simply not designed to work with Pointer Events at all.

Now to diagnose why double-tap-to-zoom the map doesn&apos;t work…</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1575256</commentid>
    <comment_count>6</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2019-09-30 07:43:12 -0700</bug_when>
    <thetext>OK, the double-tap issue is also a Leaflet issue. Consider this code in DomEvent.DoubleTap.js:

	function onTouchStart(e) {
		var count;

		if (Browser.pointer) {
			if ((!Browser.edge) || e.pointerType === &apos;mouse&apos;) { return; }
			count = _pointersCount;
		} else {
			count = e.touches.length;
		}

		if (count &gt; 1) { return; }

		var now = Date.now(),
		    delta = now - (last || now);

		touch = e.touches ? e.touches[0] : e;
		doubleTap = (delta &gt; 0 &amp;&amp; delta &lt;= delay);
		last = now;
	}

The function branches early between user agents that support Pointer Events and those that don&apos;t (based on `Browser.pointer`), but if `Browser.edge` is false it returns early. That property is false in iOS 13 and thus this function returns early and a &quot;dblclick&quot; event is never dispatched on the Leaflet Map object.

So all reported issues are Leaflet issues, there is nothing for us to do here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1575457</commentid>
    <comment_count>7</comment_count>
    <who name="Tomas Slavkovsky">tomas.slavkovsky</who>
    <bug_when>2019-10-01 00:43:03 -0700</bug_when>
    <thetext>Thanks for looking into this. Confirming that it is a bug on Leaflet JS side. Will follow the track on Leaflet&apos;s Github.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>379833</attachid>
            <date>2019-09-30 06:43:43 -0700</date>
            <delta_ts>2019-09-30 06:43:43 -0700</delta_ts>
            <desc>Leaflet test</desc>
            <filename>leaflet.html</filename>
            <type>text/html</type>
            <size>1132</size>
            <attacher name="Antoine Quint">graouts</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8aGVhZD4KCQoJPHRpdGxlPlF1aWNrIFN0YXJ0IC0gTGVh
ZmxldDwvdGl0bGU+CgoJPG1ldGEgY2hhcnNldD0idXRmLTgiIC8+Cgk8bWV0YSBuYW1lPSJ2aWV3
cG9ydCIgY29udGVudD0id2lkdGg9ZGV2aWNlLXdpZHRoLCBpbml0aWFsLXNjYWxlPTEuMCI+CgkK
CTxsaW5rIHJlbD0ic2hvcnRjdXQgaWNvbiIgdHlwZT0iaW1hZ2UveC1pY29uIiBocmVmPSJkb2Nz
L2ltYWdlcy9mYXZpY29uLmljbyIgLz4KCiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9
Imh0dHBzOi8vdW5wa2cuY29tL2xlYWZsZXRAMS41LjEvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAg
PHNjcmlwdCBzcmM9Imh0dHBzOi8vdW5wa2cuY29tL2xlYWZsZXRAMS41LjEvZGlzdC9sZWFmbGV0
LXNyYy5qcyI+PC9zY3JpcHQ+CgoKCQo8L2hlYWQ+Cjxib2R5PgoKCgo8ZGl2IGlkPSJtYXBpZCIg
c3R5bGU9IndpZHRoOiA2MDBweDsgaGVpZ2h0OiA0MDBweDsiPjwvZGl2Pgo8c2NyaXB0PgoKCXZh
ciBteW1hcCA9IEwubWFwKCdtYXBpZCcpLnNldFZpZXcoWzUxLjUwNSwgLTAuMDldLCAxMyk7CgoJ
TC50aWxlTGF5ZXIoJ2h0dHBzOi8vYXBpLnRpbGVzLm1hcGJveC5jb20vdjQve2lkfS97en0ve3h9
L3t5fS5wbmc/YWNjZXNzX3Rva2VuPXBrLmV5SjFJam9pYldGd1ltOTRJaXdpWVNJNkltTnBlalk0
TlhWeWNUQTJlbVl5Y1hCbmRIUnFjbVozTjNnaWZRLnJKY0ZJR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