iPad — Javascript focus on select outside of viewport

Originator:lewisdorigo
Number:rdar://19794600 Date Originated:11-Feb-2015 10:27 AM
Status:Open Resolved:
Product:iOS Product Version:8.1.3 (12B466
Classification:Other Bug Reproducible:Always
 
Summary:
In Safari, if Javascript gives focus to a `<select>` element outside the viewport, the element is given focus, and the page scrolls to show the focused element, but the UI for the options is not shown on screen, meaning the user must tap the screen to unfocused the element, then tap again.

I’ve provided an example page that demonstrates the issue.

Steps to Reproduce:
1. Focus on a `select` element outside the viewport, using javascript

Expected Results:
The page scrolls to the focused element, and the UI to select options is visible.

Actual Results:
The page scrolls to the focused element, but the UI to the select options is not visible.

Version:
iOS 8.1.3 (12B466); iOS 8.1 (12B411, iOS Simulator)

Notes:
The issue does not occur on iPhone, as the UI for selecting an option is fixed to the bottom of the screen.

Ostensibly, on iPad, the UI is showing, but is positioned before the page scrolls to the element. So when the scroll happens, it’s outside the visible area of the screen.

Configuration:
iPad Mini with Retina Display, iPad Air (iOS Simulator), iPad 2 (iOS Simulator)

Attachments:
Example: http://f.cl.ly/items/3V430T3M1x392O3m3M3g/index.html

Comments

A workaround would be to scroll the page so the element is visible in the viewport, prior to giving focus to the element.

By lewisdorigo at Feb. 11, 2015, 10:35 a.m. (reply...)

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!