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

RE: Styling HTML placeholder attribute

From: Sylvain Galineau <sylvaing@microsoft.com>
Date: Wed, 23 Jan 2013 00:38:54 +0000
To: Tab Atkins Jr. <jackalmage@gmail.com>
CC: Mounir Lamouri <mounir@lamouri.fr>, www-style list <www-style@w3.org>
Message-ID: <3C4041FF83E1E04A986B6DC50F0178291BF49D49@TK5EX14MBXC221.redmond.corp.microsoft.com>
[Tab Atkins Jr.:]
> On Tue, Jan 22, 2013 at 1:41 PM, Sylvain Galineau <sylvaing@microsoft.com>
> wrote:
> > Sorry, I still don't follow. If the author sets his inputs' background
> > to black we currently expect her to also change the foreground color
> > accordingly in order to make users' input visible as they type. I
> > don't get why it is OK to require her to do that for the stuff the
> > user will actually type in but it's somehow too large a burden for
> > placeholder text that we need a dedicated pseudo-element?
> You're missing my point.  In the pseudo-element scenario (using opacity),
> you get color-matching and decent contrast *automatically*, without the
> author having to explicitly provide anything.  That's the benefit I'm
> pointing to here.

I got it the first time. Authors are expected to adjust their foreground color
to be compatible with their background color for all elements. I don't think 
it's unreasonable for them to do the same with their placeholder styling whenever
they use their own control color scheme *and* placeholder text. Adding a 
pseudo-element - objects which are generally expected to handle a lot more 
than opacity - just to make this one UA stylesheet rule more likely to survive 
seems like overkill. 

Said differently, I'd much prefer this one scenario to be one of many use-cases
suggesting a pseudo-element.

In addition, a pseudo-element would still not cover some scenarios authors
will request e.g. transitions between the placeholder and input states.

> > There are other issues e.g. as it presumably overlays above the
> > control the opacity set on the pseudo-element will also affect the
> > underlying background color the author has chosen which may not be what
> she wanted.
> The background color is set on the element itself, not the pseudo inside
> of it.

If a) the placeholder pseudo renders above the element's background and b) its 
default background color is the initial transparent value then your UA stylesheet
rule will also affect the background color specified by the author for the element.

> > This particular scenario doesn't suggests a pseudo-element to me as
> > much as a property to set foreground color alpha independently of
> > foreground color. That could be more generally useful.
> That would also work.
Received on Wednesday, 23 January 2013 00:40:06 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:25 UTC