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

New pseudo-class for submit controls when the form is invalid

From: Mounir Lamouri <mounir.lamouri@gmail.com>
Date: Fri, 24 Sep 2010 14:09:02 -0700
Message-ID: <4C9D136E.8090707@gmail.com>
To: www-style@w3.org
(This is another cross-post from whatwg mailing-list. Next time, I will
send to both list initially...)

Hi,

It sounds like currently the whatwg HTML specifications want explicitly
to have all submit controls being subject for constraint validation [1]
which seems to be a weird idea. Given that only setCustomValidity() can
be used on those controls, the only use case I see is to set the submit
controls invalid when the form is invalid thus having :invalid style
applying to them.

If the given use case is correct, I think we should make all submit
controls barred from constraint validation and introduce a new
pseudo-class allowing to style submit controls when their form is
invalid. This would prevent having invalid elements styled exactly like
the submit controls (which would let the user think the submit control
is invalid) and it would prevent having :valid applying on buttons for
no apparent reason.
This pseudo-class would apply on all submit control inside a form which
has at least one invalid element subject for constraint validation.
Note: disabled submit controls could be excluded, I've no strong opinion
about that considering it's really easy to add :enabled in the CSS rule.

Current Gecko nightlies (and next beta, beta7) have a
:-moz-submit-invalid pseudo-class. Submit controls can still be marked
invalid but that might change before the final release if there is an
agreement that :-moz-submit-invalid is a better way to fulfill the need.

As a side note for web authors on this list, :-moz-submit-invalid
currently has a default style on Firefox but that is very likely going
to change for beta8.

[1] all button types are barred except the submit one:
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-button-element

Thanks,
--
Mounir
Received on Friday, 24 September 2010 21:09:53 GMT

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