I have an onclick event that triggers a function which then calls getElementById().focus() on a text input. On the first tap, it will work just fine. On subsequent taps, however, it no longer focuses on the text input and it requires the user to tap on the text input. This is for an embedded app in Shopify POS which opens in a Safari Webview and I have also reproduced the behavior in iOS Safari as well (which embeds in an iFrame). I believe I have isolated the cause of this to updating to iOS 14 (I am testing this on a physical 6th gen iPad). I have verified that on a physical iPhone running iOS 13, xcode iPad emulator running iOS 13.4, and another physical iPad running iOS 12, the .focus() still works as intended. Pre iOS 14: https://photos.app.goo.gl/hdpHDooFw6LPGdbQ7 After iOS 14 update: https://photos.app.goo.gl/BCbEyqchkFPnJNwM9
<rdar://problem/70553542>
Thanks for filing, can you please attach a reduced test case that illustrates this issue?
Created attachment 412601 [details] reduced test case Please see reduced test case attached. I'm relatively new to web development so it's very possible it might be a bug on my end. When I test this in mobile safari on iOS 14, the keyboard never appears and the focus never happens. On xcode simulator iOS 13.3, the focus happens every time.
Thanks Derrick, that works! I cannot reproduce this on iOS 13.6.1, I can reproduce it on the latest iOS 14.2 beta. I'll get this routed to the right folks.
Appears to be resolved in 14.5.1, thank you team.
Unable to reproduce.