[whatwg] Focus remains on Hidden Element

Ian Hickson ian at hixie.ch
Tue Feb 21 21:27:10 PST 2012

On Sat, 8 Oct 2011, Kaustubh Atrawalkar wrote:
> In a form element, If a form input element has a focus and its then made 
> hidden using style property display:none the focus still remains on the 
> hidden element. According to specs ( 
> http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#focus-management- 
> 4th point) hidden input elements can not be focused. But there is still 
> inconstancy in the browsers.

The spec requires that focus be dropped in this case:

"When an element that is focused stops being a focusable element, or stops 
being focused without another element being explicitly focused in its 
stead, the user agent should synchronously run the focusing steps for the 
body element, if there is one; if there is not, then the user agent should 
synchronously run the unfocusing steps for the affected element only."

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list