[whatwg] Focus remains on Hidden Element

Kaustubh Atrawalkar kaustubh at motorola.com
Wed Mar 7 22:05:13 PST 2012

Thanks Ian for the clarification. What I understand from the comment is
that, when focused element is made display:none in this case, the focus
should be moved to body element if its there else we should blur the
focused element. There is bug for the same issue
https://bugs.webkit.org/show_bug.cgi?id=47182. I will link this thread
there for fixing the same.

- Kaustubh

On Wed, Feb 22, 2012 at 10:57 AM, Ian Hickson <ian at hixie.ch> wrote:

> 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