[Webkit-unassigned] [Bug 245123] New: Form element stealing focus without user input
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Sep 13 00:47:02 PDT 2022
https://bugs.webkit.org/show_bug.cgi?id=245123
Bug ID: 245123
Summary: Form element stealing focus without user input
Product: WebKit
Version: Other
Hardware: iPhone / iPad
OS: Other
Status: NEW
Severity: Normal
Priority: P2
Component: Forms
Assignee: webkit-unassigned at lists.webkit.org
Reporter: webkit at david.kitchen
CC: cdumez at apple.com, wenson_hsieh at apple.com
Created attachment 462307
--> https://bugs.webkit.org/attachment.cgi?id=462307&action=review
Image showing an autofocus'd form element that results in the keyboard being displayed.
Users on iOS16 have reported that Safari is now autofocusing on a form field when a page loads.
I do not have any autofocus JS in the page... and I also do not possess any Apple device so cannot verify the claim (also cannot provide Safari version... but "whatever is the latest safari after iOS16 upgrade" is the Safari version).
Example of bug report: "Minor bug but in iOS 16 Safari, the number input in the pagination captures focus on page load, so whenever you arrive at a forum list page the keyboard is launched." and the attached image by the user who reported that shows focus given to the keyboard.
Background:
I run a website with a pagination capability, here is a public example: https://www.lfgss.com/microcosms/509/
The HTML for the pagination renders this form:
```
Page
<form name="paginationByOffset" method="GET" data-initial="1" data-limit="25" data-max="391">
<input type="text" min="1" value="1" max="391" step="1" pattern="\d*" title="Enter the page number to jump to" class="form-control" />
<input name="offset" type="hidden" />
</form>
of 391
```
Some JavaScript does exist to process this when the form is submitted, i.e. go into the form, change the number, hit enter...
```
////////////////////
// pagination //
////////////////////
(function(){
$('form[name=paginationByOffset]').submit(function(e){
console.log("Page jump requested")
var self = $(this),
initial = self.attr('data-initial'),
limit = self.attr('data-limit'),
max = self.attr('data-max'),
value = parseInt(self.find('input[type=text]').val()),
hidden = self.find('input[name=offset]');
console.log("limit = " + limit + " , max = " + max + " , value = " + value);
if (!isNaN(value) && value >= 1 && value <= max && value != initial) {
console.log("Jump")
if (limit && value){
hidden.val(limit * (value-1));
}
} else {
console.log("Cancel jump")
e.preventDefault();
}
});
$('form[name=paginationByOffset] > input[type=text]').blur(function() {
$(this).parent().submit();
});
})();
```
It is claimed that on iOS16 *only* that this will autofocus.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220913/4ee29429/attachment.htm>
More information about the webkit-unassigned
mailing list