In the era before iOS8, when utilizing the Javascript .focus()
method on an input element, it seemed as though nothing happened - the virtual keyboard did not make an appearance. However, with the latest iOS 8 update, executing the .focus()
method initially seemed ineffective upon page load. Nevertheless, once a user tapped anywhere on the screen, the virtual keyboard would promptly pop up and scroll the page to the focused element. This predicament also occurred when employing the HTML attribute "autofocus."
This alteration has led to complications for iOS8 users visiting my website. When attempting to click a button, the abrupt scrolling and sudden keyboard presence often causes them to accidentally tap a button located further down the screen.
I presume that this is a flaw in iOS8 rather than an intentional feature. Therefore, my query is: what is the most efficient solution to rectify this issue?
Must I consistently check navigator.userAgent
to determine if the device is running iOS8 whenever I utilize the .focus()
method?