This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 7411 - :invalid and :out-of-range shouldn't match until the user has consciously interacted with the form. Roughly, after the input fires a change event. If, say, <input required> matches :invalid immediately on pageload, it becomes basically useless.
Summary: :invalid and :out-of-range shouldn't match until the user has consciously int...
Status: CLOSED WONTFIX
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML5 spec (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: All All
: P3 normal
Target Milestone: LC
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: http://whatwg.org/specs/web-apps/curr...
Whiteboard:
Keywords: NE
Depends on:
Blocks:
 
Reported: 2009-08-24 21:57 UTC by contributor
Modified: 2010-10-04 14:48 UTC (History)
4 users (show)

See Also:


Attachments

Description contributor 2009-08-24 21:57:07 UTC
Section: http://whatwg.org/specs/web-apps/current-work/#matching-html-elements-using-selectors

Comment:
:invalid and :out-of-range shouldn't match until the user has consciously interacted with the form.  Roughly, after the input fires a change event.  If, say, <input required> matches :invalid immediately on pageload, it becomes basically useless.

Posted from: 99.35.179.251
Comment 1 Tab Atkins Jr. 2009-08-25 00:58:01 UTC
To be specific, if <input required> matches :invalid immediately on pageload, then all the warnings an author can specify for invalid inputs (red border, special background, etc) pop up immediately.  This is generally unacceptable from a design standpoint - we only want to tell a user they've made a mistake *after they've actually made a mistake*.

This argument applies generally for anything that can cause an input to match :invalid.
Comment 2 Ian 'Hixie' Hickson 2009-09-21 10:40:55 UTC
Surely if the user loads a form, sees there's nothing wrong, and hits submit, that's worse than if the user loads a form and sees a lot of red before typing anything?

Also, what about forms that did round-trips through the server? Surely those will want to be red straight away, regardless?

It seems like if you want what you describe, you should just do this:

   <form onchange="event.target.classList.add('dirty')">

...and then in the CSS use ":invalid.dirty" instead of ":invalid".
Comment 3 Maciej Stachowiak 2010-03-14 14:50:00 UTC
This bug predates the HTML Working Group Decision Policy.

If you are satisfied with the resolution of this bug, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
  http://dev.w3.org/html5/decision-policy/decision-policy.html

This bug is now being moved to VERIFIED. Please respond within two weeks. If this bug is not closed, reopened or escalated within two weeks, it may be marked as NoReply and will no longer be considered a pending comment.