Safari in iOS 16 autofocusing form elements

Issue

This Content is from Stack Overflow. Question asked by Ellessar

I noticed that Safari in new iOS 16.0 autofocuses an input element if:

  1. type=number or text
  2. pattern=d*
  3. margin-top on containing element is 48px (I did not test the precise cut-off value here)

Test page: https://www.autoledky.sk/ios.php

autocomplete=off and autofocus=false doesn’t change anything. Before iOS 16 there were no such issues. The problem is confirmed on 2 seperate iPhones with iOS 16.

This leads to automatic homepage scrolling, enlarging and opening the keypad, which is unacceptable.
How should I solve the issue without obvious “remove input/pattern”.



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?