[selectors] Re: css4 focus-within

(Moving to public lists, since w3c-wai-pf silently drops replies from non-members)

On Jan 6, 2015, at 9:29 AM, Fred Esch <fesch@us.ibm.com> wrote:

> The CSS Selectors Level 4 has a focus-within selector  http://dev.w3.org/csswg/selectors-4/#focus-within-pseudo. This selector will help developers make web sites more accessible as they will be able to mimic what they do with css hover with css hover-within. Can we ask that this selector be a priority for browsers?
> 
> One common web accessibility problem is inaccessible menus and multi level menus. A developer can use css hover to make the menus and sub menus visible. This works because hover bubbles, so when a sub menu gets the hover the parent menu still has hover too.  Developers are not so lucky when it comes to keyboard users. CSS focus does not bubble so making a multi level menu using focus is problematic. The focus-within  selector solves the focus doesn't bubble problem so hover and focus-within can work the same way, allowing keyboard users the same access as mouse users.  
> Can we ask that this selector be a priority for browsers?

I was under the impression that this would be solved by the subject selector. Does this addition mean that the following two selectors are equivalent?

!* *:focus {}
*:focus-within {}

The readability of the second is more apparent, but the subject selector is much more powerful. If you include both, I'd make a note in :focus-within that it's equivalent to "!* *:focus"

James

Received on Tuesday, 6 January 2015 21:29:38 UTC