Tapping into an <input> within a position:fixed element scrolls to the top of the page

Originator:cvrebert
Number:rdar://24235301 Date Originated:19-Jan-2016
Status:Closed Resolved:22-Jan-2016
Product:Safari Product Version:iOS 9.2
Classification:Other Bug Reproducible:Always
 
Summary:
In iOS Safari, tapping into an <input> which is within a position:fixed element has the side-effect of causing the page to scroll to the top, regardless of the current scroll position. This is annoying e.g. when using position:fixed modal dialogs for forms, since this scrolling causes the user to lose their scroll position in the underlying page after the modal dialog has been closed (unless additional hacky iOS-specific JS was also added to manually restore the old scroll position that this bug trashed).

Steps to Reproduce:
1. Open http://output.jsbin.com/qicigu/1 in iOS Safari.
2. Scroll to the bottom of the page.
3. Tap the "Open modal" button.
4. A yellow overlay appears.
5. Tap on the <input> that has the text "Click here".

Expected Results:
The input should become focused and the on-screen keyboard should appear.
The scroll position of the page should not change.

Actual Results:
The page scrolls to the top, the input becomes focused, and the on-screen keyboard appears.

Version:
iOS 9.2

Notes:
No such scrolling occurs in Android Chrome or OS X Safari.
WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=153224
Original Bootstrap bug report: https://github.com/twbs/bootstrap/issues/17497

Configuration:


Attachments:

Comments

Closed as Duplicate

DevRel closed this as a duplicate of rdar://19708696 (which itself is currently Open).


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!