Bug 16812

Summary: onFocus causes cursor to be in wrong location if MobileSafari resizes page
Product: WebKit Reporter: Michael Croft <mcroft>
Component: FormsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: ddkilzer, mrowe
Priority: P2 Keywords: InRadar
Version: 420+   
Hardware: Other   
OS: Other   
URL: http://www.whiterose.org/test/onfocusissue.html
Attachments:
Description Flags
reduced test case none

Description Michael Croft 2008-01-09 20:44:35 PST
[If you're not looking for/at MobileSafari bugs here, my apologies.  If you are, might be worthwhile to add platform/OS for it...]

OS iPhone 3B48b (1.1.2) 

This page uses onfocus to clear an example value in a text input field.  This works fine in Safari (and other browsers) but causes a focus problem in Mobile Safari (in portrait orientation).  The key code is 
input type="text" name="IphoneNumber" value="ex. 5125551212" onfocus="this.value=''"

If I take out onfocus, this works fine.

We were unable to duplicate the problem with iPhone software 1.0.2

Steps to reproduce:
1: open the attached page in portrait mode on an iPhone
2: touch the text field
expected results: the field becomes blank and the cursor moves to the first character in the field.
actual results: the cursor and the focus are somewhere before the field.  Typing can happen, but it's not in the right field.

I've tried this with different doctypes and with and without the viewport meta setting.  The page validates.  There is no problem if the form is the first item on the page or if the iPhone is in landscape mode (no scaling happens).  The H1 element is involved, if only because of the width of the page.  If the scaling has already occurred (such as if you re-open the page while it's already the right size for the form), the focus goes to the right place.

Reduction at the URL listed.
Comment 1 Michael Croft 2008-01-09 20:46:56 PST
Created attachment 18360 [details]
reduced test case
Comment 2 Mark Rowe (bdash) 2008-01-09 20:48:24 PST
Bugs in Safari on the iPhone should be reported in Radar at http://bugreport.apple.com/.  I'm going to migrate this bug to Radar and close this bug.
Comment 3 Mark Rowe (bdash) 2008-01-09 20:49:37 PST
<rdar://problem/5680715>