Javascript geocoder 10 key panning

3373
4
Jump to solution
08-27-2014 07:42 AM
StanMcShinsky
Occasional Contributor III

I have noticed that on the esri example ArcGIS API for JavaScript | Simple Geocoding  when you click on the text box to start typing in an address everything works fine until you try to use the 10 key or key pad when the mouse is not hovering over the box. If the mouse is hovering over the map and you try to use the key pad then the map starts panning around and nothing goes in the search box. Move the mouse over the box and all works fine again. Any ideas how to fix this? Kelly Hutchins

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JohnGravois
Frequent Contributor

hi stan,

good find. i wasn't able to workaround the issue using public events emitted by the widget, but it was possible to resolve the problem by updating the widget source itself by calling the method below from within the private method _inputClick() of the widget itself (near line 1205 of Geocoder.js)

this.get("map").disableKeyboardNavigation();

afterwards, we have to make sure it gets turned back on when the widget is no longer being used:

this.get("map").enableKeyboardNavigation();

the second method needs to be called within both blur() and _performTask() to ensure that keyboard navigation returns whether a search is performed or whether someone clicks on the widget and then just clicks back on the map.

i was able to determine all this by downloading the widget source and pointing the simple sample at the local code.  afterwards, setting breakpoints in methods that seemed relevant helped me narrow down where i actually needed to place my calls to map.disableKeyboardNavigation()

hope that helps.  i'll make sure we get the widget updated with this change in the next release!

View solution in original post

4 Replies
JohnGravois
Frequent Contributor

hi stan,

good find. i wasn't able to workaround the issue using public events emitted by the widget, but it was possible to resolve the problem by updating the widget source itself by calling the method below from within the private method _inputClick() of the widget itself (near line 1205 of Geocoder.js)

this.get("map").disableKeyboardNavigation();

afterwards, we have to make sure it gets turned back on when the widget is no longer being used:

this.get("map").enableKeyboardNavigation();

the second method needs to be called within both blur() and _performTask() to ensure that keyboard navigation returns whether a search is performed or whether someone clicks on the widget and then just clicks back on the map.

i was able to determine all this by downloading the widget source and pointing the simple sample at the local code.  afterwards, setting breakpoints in methods that seemed relevant helped me narrow down where i actually needed to place my calls to map.disableKeyboardNavigation()

hope that helps.  i'll make sure we get the widget updated with this change in the next release!

StanMcShinsky
Occasional Contributor III

Thanks for looking into this and find out how to fix it. I will look forward to the solution.

0 Kudos
JohnGravois
Frequent Contributor

because that widget is open source, it isn't too hard to tweak it to meet your needs and reference as a local AMD module instead of pointing at the one in the API.  i've attached a sample project (with the changes i mentioned in my previous post) in case you'd like to take a look.

JohnGravois
Frequent Contributor

fix has been merged.