W3C home > Mailing lists > Public > www-style@w3.org > January 2012

[css4-selectors] Focused descendant pseudo class

From: Rudolph Gottesheim <r.gottesheim@loot.at>
Date: Wed, 25 Jan 2012 20:45:01 +0100
Message-ID: <4F205BBD.8060604@loot.at>
To: www-style@w3.org
A while ago I asked[1] the www-style list for a solution to selecting 
the parent of a focused form input, which (once again) kicked off the 
discussion about a parent selector (which is still no option, as far as 
I can tell).

Now I've come across another use case and probably another solution to 
the same problem:

Suppose you have a form with a text input and a submit button. Now you 
want to hide the submit button to un-clutter the interface, but show it 
as soon as the user focuses the input element.

<form>
	<input />
	<input type=submit />
</form>

form input[type=submit] {
	display: none;
}

Would it be possible to implement a "some descendant of this element is 
in focus" selector? Something like :focused-child oder :contains-focus.

form:contains-focus input[type=submit] {
	display: block;
}

[1] http://lists.w3.org/Archives/Public/www-style/2011Oct/0275.html
Received on Wednesday, 25 January 2012 19:45:34 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:49 GMT