Focus () doesn't work in ion mode using Safari ios 10 browser

focus () does not work in ion mode using the Safari ios 10 browser.

It works when you use the chrome emulator, but not when using the Safari ios 10 browser.

below is the code that I use to focus the element.

var rvMobileApp = angular.module('rvMobileApp.shared.directive'); rvMobileApp.directive('rvSetFocus', function ($timeout) { return { link: function (scope, element, attrs) { $timeout(function () { element[0].focus(); }, 100); } }; 

Thanks in advance.

+6
source share
1 answer

By default, iOS does not allow keyboard interaction, unless you use an input field.

To override this, you need to put this in the config.xml file:

 <preference name="KeyboardDisplayRequiresUserAction" value="false" /> 
0
source

Source: https://habr.com/ru/post/1012214/


All Articles