<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Context Menu on IOS in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/context-menu-on-ios/m-p/603562#M56510</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a similar question as asked previously in the forum&amp;nbsp;&lt;A _jive_internal="true" href="https://community.esri.com/thread/189070-ios-oncontextmenu-support"&gt;here.&lt;/A&gt; I have implemented the context menu in an app and it works with long press on android, but not on ios. I tried the esri context menu sample and it too fails on ios.&amp;nbsp; I know that ios handles mouse events natively, and they don't bubble by default, but I have followed all the published advice, including adding 'pointer: cursor; to all nodes in the DOM, and created empty mouse events (click handlers) in the code, but I can only get alerts to work when inserted into the click handlers that I create, using touchstart or mousedown as the event, and even tried to use 'contextmenu' event, but that doesn't work on ios either. I can't tell how far the long press gets: It seems to be a problem with dojo menu.js, but I have not had the opportunity yet to debug an ipad on a mac (I use Windows at work, and the Chrome simulator cannot simulate native ios mouse events: the context menu works fine in the Chrome simulator).&lt;/P&gt;&lt;P&gt;The gist of the problem is described &lt;A href="http://gravitydept.com/blog/js-click-event-bubbling-on-ios"&gt;here&lt;/A&gt; and &lt;A href="https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html"&gt;here&lt;/A&gt; and &lt;A href="https://gist.github.com/asimpson/4664308"&gt;here.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Since the esri sample doesn't seem to work on ios either, I wonder if the esri javascript api supports ios fully or even well? An app that does not work on iPad is not going to be successful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope there is a work-around. I am using the bower build, so I do have access to the menu.js, if it is necessary to adjust anything there. Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jim Faron&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Jun 2017 23:51:48 GMT</pubDate>
    <dc:creator>JamesFaron</dc:creator>
    <dc:date>2017-06-06T23:51:48Z</dc:date>
    <item>
      <title>Context Menu on IOS</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/context-menu-on-ios/m-p/603562#M56510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a similar question as asked previously in the forum&amp;nbsp;&lt;A _jive_internal="true" href="https://community.esri.com/thread/189070-ios-oncontextmenu-support"&gt;here.&lt;/A&gt; I have implemented the context menu in an app and it works with long press on android, but not on ios. I tried the esri context menu sample and it too fails on ios.&amp;nbsp; I know that ios handles mouse events natively, and they don't bubble by default, but I have followed all the published advice, including adding 'pointer: cursor; to all nodes in the DOM, and created empty mouse events (click handlers) in the code, but I can only get alerts to work when inserted into the click handlers that I create, using touchstart or mousedown as the event, and even tried to use 'contextmenu' event, but that doesn't work on ios either. I can't tell how far the long press gets: It seems to be a problem with dojo menu.js, but I have not had the opportunity yet to debug an ipad on a mac (I use Windows at work, and the Chrome simulator cannot simulate native ios mouse events: the context menu works fine in the Chrome simulator).&lt;/P&gt;&lt;P&gt;The gist of the problem is described &lt;A href="http://gravitydept.com/blog/js-click-event-bubbling-on-ios"&gt;here&lt;/A&gt; and &lt;A href="https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html"&gt;here&lt;/A&gt; and &lt;A href="https://gist.github.com/asimpson/4664308"&gt;here.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Since the esri sample doesn't seem to work on ios either, I wonder if the esri javascript api supports ios fully or even well? An app that does not work on iPad is not going to be successful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope there is a work-around. I am using the bower build, so I do have access to the menu.js, if it is necessary to adjust anything there. Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jim Faron&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Jun 2017 23:51:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/context-menu-on-ios/m-p/603562#M56510</guid>
      <dc:creator>JamesFaron</dc:creator>
      <dc:date>2017-06-06T23:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: Context Menu on IOS</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/context-menu-on-ios/m-p/603563#M56511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem is that iOS does not process the contextmenu mouse event, as both Android and Windows do.&amp;nbsp;Unfortunately unless you are using the Bower build, there is no current fix for the problem, as it requires a significant hack to the menu.js in dojo's digit directory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The dojo menu.js code that won't work in iOS:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;on(cn, delegatedEvent(this.leftClickToOpen ? "click" : "contextmenu"), function(evt){&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fix requires a separate section of code for ios. First bring in the dojox/gesture/tap module to menu.js. Then as follows:&lt;/P&gt;&lt;P&gt;//create a var for tap.hold with a long enough hold time to prevent from being activated on swipe gesture&lt;/P&gt;&lt;P&gt;var myTap = new dojox.gesture.tap.Tap({holdThreshold: 1000});&lt;/P&gt;&lt;P&gt;//separate code for ios only:&lt;/P&gt;&lt;P&gt;if(has("ios")){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;var hammertime = Hammer(dom.byId("mapViewDiv_root"));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;hammertime.get('press').set({&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;time: 1000,&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pointers: 1,&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;threshold: 9&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;var self = this;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;hammertime.on("press", function (e) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;var x, y;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;x = e.center.x;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;y = e.center.y;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;self.myX = x;&lt;BR /&gt; &amp;nbsp;&amp;nbsp; self.myY = y;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;});&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;var doConnects = lang.hitch(this, function(cn){&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var selector = this.selector,&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;delegatedEvent = selector ?&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function(eventType){&lt;/P&gt;&lt;P&gt;//the folowing is necessary to keep iOS from freezing any other click events on the map, due to using dojox/gesture&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(cn.className == "esriMapContainer"){&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cn.dojoClick = true;}&lt;/P&gt;&lt;P&gt;//end add&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return on.selector(selector, eventType);&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} :&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function(eventType){&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return eventType;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;//self= this not needed here since it is declared above&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;nbsp;self = this;&amp;nbsp;&lt;/P&gt;&lt;P&gt;return [&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;on(cn, delegatedEvent(this.leftClickToOpen ? "click" : myTap.hold), function(evt){&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;evt.stopPropagation();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;evt.preventDefault();&lt;/P&gt;&lt;P&gt;//need to this to clear the element for other click events.Not sure why at this point:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;query(dom.byId("mapViewDiv_root")).on(myTap.hold, function(e){e.preventDefault()});&lt;/P&gt;&lt;P&gt;//need to allow other node menu events to work as usual, thus separate code for the context menu&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(evt.target.nodeName == "svg"){&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;self._scheduleOpen(this, iframe, {x: self.myX, y: self.myY}, evt.target);&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}else{&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;self._scheduleOpen(this, iframe, {x: evt.pageX, y: evt.pageY}, evt.target);&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;//end altered/added code: the rest can be taken as written in menu.js.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use an 'else' statement to move from 'has(ios)' to&amp;nbsp;the original code for all other devices. Hammer.js is necessary as documented elsewhere due to dojox/gesture not returning screen coordinates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps someone. Took me a few days to figure everything out. Unfortunately, I'm getting used to this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jun 2017 18:15:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/context-menu-on-ios/m-p/603563#M56511</guid>
      <dc:creator>JamesFaron</dc:creator>
      <dc:date>2017-06-14T18:15:10Z</dc:date>
    </item>
  </channel>
</rss>

