Bug 49300 - autofocus attribute on input in hidden div causes dynamic display of div to fail
Summary: autofocus attribute on input in hidden div causes dynamic display of div to fail
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 525.x (Safari 3.2)
Hardware: All All
: P2 Major
Assignee: Nobody
URL: http://amp.ishiboo.com/webkit_autofoc...
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-09 22:32 PST by Andrew Paprocki
Modified: 2019-10-07 13:33 PDT (History)
4 users (show)

See Also:


Attachments
stand-alone test case (1.69 KB, text/html)
2010-11-10 05:14 PST, Andrew Paprocki
no flags Details
Another simple test case showing autofocus breaking stuff (689 bytes, application/zip)
2010-11-25 06:04 PST, Daniel Fazekas
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Paprocki 2010-11-09 22:32:14 PST
I created the above URL, http://amp.ishiboo.com/webkit_autofocus_bug.html with a 44 line stand-alone test case to reproduce this problem. The second div starts out hidden and has an input with the autofocus attribute. When the first div is clicked upon, the second div is made visible. At this point, clicking the checkbox will toggle the sensitivity of the second input box (setting input.disabled=''), the label associated with it (via css selector), and the fieldset it lives in (setting className = 'enabled'). None of these have any effect while the autofocus attribute remains on the first input box.

To see the page working properly, two things make it work:

1) Change the second div from display:none to display:block. If the second div is visible to start with, the checkbox always works.

2) Remove the autofocus attribute from the first input field. Even if the second div is display:none to begin with, if the autofocus attribute is removed, the checkbox works when the second div is dynamically shown.

I tested and this bug exists on Chrome 7, as well as Safari in latest iOS on both iPhone and iPad. The webpage works as expected in Firefox 4 / IE 8 (probably because they do not support autofocus yet).
Comment 1 Andrew Paprocki 2010-11-10 05:14:23 PST
Created attachment 73490 [details]
stand-alone test case
Comment 2 Daniel Fazekas 2010-11-25 06:04:37 PST
Created attachment 74867 [details]
Another simple test case showing autofocus breaking stuff

Added my test case. There's no need for checkboxes or for the autofocus field to start hidden.
There's simply a button to hide a div which will have no effect in WebKit-based browsers if the autofocused input remains.
Comment 3 Ryosuke Niwa 2019-10-07 13:33:53 PDT
This seems working as intended now.