AnsweredAssumed Answered

Bug? Map fires 'extent-changed' event upon a single mouse click in JS API v3.8

Question asked by jay.gregory on Feb 27, 2014
Latest reply on Feb 8, 2016 by cgishack
I am running into a problem with the JS API v3.8 in which the maps 'extent-change' event is fired with a single mouse click (not double or shift+click, just a simple click on the map), even though a single mouse click does not cause the map's extent to actually change.  Normally this isn't a problem unless you have a need to run some real code when the extent actually changes.  This behavior is unfortunately preventing my popup window from appearing, because I have a function attached to the 'extent-change' event which actually clears the feature layer.  But one click should just show the popup, and not fire the 'extent-change'.  UPDATE: this only seems to be affecting Chrome
Regardless, see the following code to reproduce in the simplest manner possible:

<!DOCTYPE html> <html>   <head>     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">     <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>     <title>Simple Map</title>     <link rel="stylesheet" href="">     <style>       html, body, #map {         height: 100%;         width: 100%;         margin: 0;         padding: 0;       }       body {         background-color: #FFF;         overflow: hidden;         font-family: "Trebuchet MS";       }     </style>     <script src=""></script>     <script>       var map;       require(["esri/map",     "dojo/domReady!"],     function(    Map) {   map = new Map("map", {           basemap: "gray",          center: [-97, 38],           zoom: 5,           sliderStyle: "small"         });   map.on('extent-change', function(){console.log('extent changed');});          });     </script>   </head>   <body>     <div id="map"></div>   </body> </html>