Bug 146244 - Tapping *below* some <input>s can focus them in Mobile Safari
Summary: Tapping *below* some <input>s can focus them in Mobile Safari
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: Safari 9
Hardware: iPhone / iPad iOS 9.0
: P2 Normal
Assignee: Wenson Hsieh
URL: http://jsfiddle.net/gzxtb86c/3
Keywords: HasReduction, InRadar
Depends on:
Blocks: 159753
  Show dependency treegraph
 
Reported: 2015-06-23 12:45 PDT by Chris Rebert
Modified: 2016-08-29 23:50 PDT (History)
7 users (show)

See Also:


Attachments
Another reduced test case (1013 bytes, text/html)
2015-10-30 09:30 PDT, Wenson Hsieh
no flags Details
New reduction (reproduces without jQuery or Bootstrap) (1.06 KB, text/html)
2015-10-30 10:28 PDT, Wenson Hsieh
no flags Details
Patch (7.41 KB, patch)
2015-11-02 15:05 PST, Wenson Hsieh
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Rebert 2015-06-23 12:45:10 PDT
Original Bootstrap bug https://github.com/twbs/bootstrap/issues/15968
Platform: iOS 8.3
Browser: Mobile Safari

To reproduce:
1. Open http://jsfiddle.net/gzxtb86c/3/show in Safari in iOS 8.3
2. Tap in the vast blank area below the <input>

Expected result:
Probably nothing at all should happen. The <input> should definitely NOT become focused.

Actual result:
The <input> becomes focused.
Comment 1 Chris Rebert 2015-06-23 12:59:51 PDT
Also filed this as:

<rdar://problem/21509310>
Comment 2 Wenson Hsieh 2015-10-30 09:30:35 PDT
Created attachment 264398 [details]
Another reduced test case

What seems to be happening is that hit-testing is finding the document element instead of nothing at all when tapping in a region which the <html> covers but the <body> does not. This reduction shortens the height of the body -- observe that tapping in the body does not bring up the keyboard, but tapping in the html does.
Comment 3 Wenson Hsieh 2015-10-30 10:28:16 PDT
Created attachment 264400 [details]
New reduction (reproduces without jQuery or Bootstrap)

This is the previous test case, except with components from jQuery/Bootstrap css and js removed until we're left with a few lines of code that still reproduce the issue.

  - the first is a click handler on the document
  - the second is display: block on the text field
  - shortened body height, such that the <html> and not the <body> is clicked
Comment 4 Wenson Hsieh 2015-11-02 15:05:45 PST
Created attachment 264634 [details]
Patch
Comment 5 Darin Adler 2015-11-02 22:27:09 PST
Comment on attachment 264634 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=264634&action=review

> Source/WebCore/ChangeLog:11
> +        editable element to an editable child, is not necesary to focus editable elements underneath non-editable elements,

The word “necessary” is misspelled here.
Comment 6 Wenson Hsieh 2015-11-03 08:07:05 PST
Comment on attachment 264634 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=264634&action=review

>> Source/WebCore/ChangeLog:11
>> +        editable element to an editable child, is not necesary to focus editable elements underneath non-editable elements,
> 
> The word “necessary” is misspelled here.

Good catch! Fixed.
Comment 7 Wenson Hsieh 2015-11-03 09:16:29 PST
Committed r191954: <http://trac.webkit.org/changeset/191954>