W3C home > Mailing lists > Public > www-style@w3.org > September 2009

Re: Pseudo-Classes :button and :input

From: Tobias Herp <Tobias.Herp@gmx.net>
Date: Wed, 16 Sep 2009 22:58:14 +0200
Message-ID: <20090916205814.322910@gmx.net>
To: www-style@w3.org
Boris Zbarsky <bzbarsky@MIT.EDU> wrote:
> Was this meant to be off-list?

Ooops, no. Sorry.

> On 9/16/09 2:22 PM, Tobias Herp wrote:
> > If it /does/ exist, it will look like any other textual input control.
> I suspect that's a non-starter for security reasons, by the way.

Disagreed; see my other mail, or consider a sentence like this:

Conforming user agents which support the input pseudo-classes *must* take care that file input fields can't be mistaken for normal input fields and thus prevent file uploads unintended by the user. They can for example choose to do so by automatically opening a file dialog window when the input field is entered*, or by ignoring rules which could make the button part hard to recognize.

*) Firefox does so already

> > Yes; but this "fairly broken internal makeup" is all most of us have
> > (and perhaps will ever have).
> Every browser except IE is, to my knowledge either doing it a different 
> way or planning to do it a different way.

Will these different ways solve the formatting issue? How?

> > But it's not "new syntax", it's just two new pseudo-classes
> Yes, but the effect is to make rules using those pseudo-classes anywhere 
> not work in browsers that don't support them.

Yes. But you can't rely exclusively on attribute selectors currently anyway since IE doesn't support them; thus, classes are used. Sub-optimal.
The effort of /one/ additional selector is rewarded with nicely formatted file upload controls.

> So unless you plan to 
> stop worrying about browsers that don't support them you have to not 
> only list the attribute selector stuff, but also list all your 
> declarations twice.

For a transitional period, certainly.

What do you consider more likely: That IE supports attribute selectors (which seems to be difficult and wouldn't solve the file input issue anyway), or that two little additional pseudo-classes (all major graphical browsers know about pseudo-classes, and almost all format buttons) are supported?

> > and it is IMHO a very logical and intuitive solution.
> It has its benefits, I agree.  Especially for text controls, which are 
> very very difficult to select with attribute selectors otherwise.... 
> That _might_ make it worthwhile.  The button case is a lot less
> convincing.
> > And there is new code in browsers all the time; this feature should be
> > much easier to implement
> It wouldn't be hard to implement.  The question is whether it's worth 
> implementing and adding to the web platform in general.

Since it solves a very common problem, I do think it's worth it.

> > It solves problems for file input;
> Not really; Gecko would still not allow the styling of internal parts of 
> a file input, for example.

Why?  "It wouldn't be hard to implement".

> > It's quite logical that, if I specify a whole bunch of properties for
> textual input fields (e.g. padding, background color), I want all of them
> look the same
> Since <input type="text"> and <textarea> already have different padding, 
> vertical alignment, margins, etc in browsers by default, it's not that 
> obvious to me, actually.

Well, input fields are inline elements, textareas are blocks; but when e.g. changing the background color for :focus, I'd treat them just the same.

However, skip that part. No problem: use input:input (or input:textual, if we consider this a better name) instead just :input (or :textual, or :textual-input, whatever), and you're done.

> > I /might/ want e.g. display password fields slightly differently, but
> > very likely I would want to use at least the same properties for all
> > other textual input controls.
> I agree that for password and text inputs there's a stronger case here.
> > The same is true for all types of buttons; very likely, I would want
> > only the submit button to look /slightly/ different (e.g.
> > font-weight:bolder).
> Sure.  I didn't say I don't see the use cases for styling all your 
> buttons; I just said it's already pretty simple to do.

It is simple (while sometimes cumbersome, since input[type="submit"] input[type="button"] and button are to be considered) for all buttons *but* those in input[type="file"].

> > I know about the attribute selectors; but they just *don't work* for
> > the file type input elements.
> Neither will this; see above.

(Sorry, I can't follow you here)


Received on Wednesday, 16 September 2009 20:58:56 UTC

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