[whatwg] Document.activeElement should return the root element in non-HTML documents when no element has focus

Ian Hickson ian at hixie.ch
Mon Feb 3 11:37:16 PST 2014

On Sat, 1 Feb 2014, Cameron McCormack wrote:
> Document.activeElement is currently defined to return the <body> element 
> if there is not element with focus, or null if there's no <body> 
> element.  I think it needs to return the root element when the document 
> isn't an HTML document (like an SVG document).

I'm actually about to completely revamp how focus is defined, so that it 
actually matches reality way better (e.g. right now the spec completely 
misses that it's the viewport that's focused when "nothing" is focused, 
and fails to even allow scroll regions to be focused, etc), and so that it 
properly supports <dialog>s as a separate kind of focusable object.

I have a detailed proposal here:


I've noted your proposal above in comment 18.

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