etodanik / ion-google-place

Ionic directive for a location dropdown that utilizes google maps
MIT License
251 stars 201 forks source link

The popup input is not always focused #22

Closed ivanst-stoyanov closed 9 years ago

ivanst-stoyanov commented 9 years ago

Sometimes when I click on the input that triggers the popup, the popup is shown, but the input is not focused and the keyboard does not show. It took me a while to understand why this is happening. The problem appears to be with the ionic auto scroll to focused input. Sometimes when the first (readonly) input is clicked and the popup is shown, ionic tries to scroll to the readonly input. I have tried to add a bigger delay to the code that focuses the input, but it is not working. I presume that there should be a way to stop the ionic auto scroll from triggering.

Does any of you guys experienced this problem? Any fix for this?

P.P. I have created a forum post in the ionic forum regarding this issue. http://forum.ionicframework.com/t/disabling-ionic-auto-scroll-to-focused-input/16140

ivanst-stoyanov commented 9 years ago

I've solved the problem by focusing the input in a timeout with 0 delay and after that in a timeout with 50 delay. $timeout(function () { searchInputElement[0].focus(); }, 0);

$timeout(function () { searchInputElement[0].focus(); }, 50);

stevecarlton commented 8 years ago

@ivanst-stoyanov sounds like a good workaround as I am seeing this issue as well. May I ask where you added that code and are the two lines together?

ivanst-stoyanov commented 8 years ago

@stevecarlton I added the code inside var onClick = function(e){ You can add setTimeout(function(){ searchInputElement[0].focus(); },50); after the original timeout of 0

stevecarlton commented 8 years ago

Ahh, thank you for the clarification!

On Thu, Nov 12, 2015 at 7:28 AM, Ivan Stoyanov notifications@github.com wrote:

@stevecarlton https://github.com/stevecarlton I added the code inside var onClick = function(e){ You can add setTimeout(function(){ searchInputElement[0].focus(); },50); after the original timeout of 0

— Reply to this email directly or view it on GitHub https://github.com/israelidanny/ion-google-place/issues/22#issuecomment-156102137 .