W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2012

Re: [whatwg] Modal Dialog Focus

From: Ian Hickson <ian@hixie.ch>
Date: Mon, 22 Oct 2012 18:02:27 +0000 (UTC)
To: Scott González <scott.gonzalez@gmail.com>
Message-ID: <Pine.LNX.4.64.1210221755580.2471@ps20323.dreamhostps.com>
Cc: whatwg@lists.whatwg.org
On Mon, 22 Oct 2012, Scott González wrote:
>
> The dialog.showModal() function defines steps for setting focus. 
> However, if the dialog does not contain any elements with the autofocus 
> attribute, then step 9 says to abort the steps and not set focus. It 
> seems problematic if the dialog is modal and does not have focus. How 
> would a keyboard user interact with the dialog? How would a screen 
> reader know that the dialog has been shown?

This is no different than when the page first loads. If nothing has 
autofocus="", or if no script calls .focus(), then nothing in the page has 
focus. Keyboard users can still use the page (or dialog, in this case), 
because user agents let keyboard users navigate through pages -- hit the 
tab key, and the first thing gets focused. It's as if the <body> holds the 
focus by default.


> I would expect the control element to fall back to the first tab 
> focusable element if no element with autofocus exists. If there is still 
> no control element, I would expect the dialog itself to receive focus.

The first focusable element is the <body> element, effectively.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Monday, 22 October 2012 18:02:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:11 GMT