HTML Standard Tracker

Diff (omit for latest revision)
Filter

Short URL: http://html5.org/r/2362

File a bug

SVNBugCommentTime (UTC)
2362[Opera] WF2: Define title= on <input> with pattern=; clarify how validity states work with disabled controls.2008-10-23 15:39
Index: source
===================================================================
--- source	(revision 2361)
+++ source	(revision 2362)
@@ -6111,8 +6111,8 @@
   multiple lines. Each U+000A LINE FEED (LF) character represents a
   line break.</p>
 
-  <p>Some elements, such as <code>link</code> and <code>abbr</code>,
-  define additional semantics for the <code
+  <p>Some elements, such as <code>link</code>, <code>abbr</code>, and
+  <code>input</code>, define additional semantics for the <code
   title="attr-title">title</code> attribute beyond the semantics
   described above.</p>
 
@@ -29022,7 +29022,46 @@
   as if it implied a <code title="">^(?:</code> at the start of the
   pattern and a <code title="">)$</code> at the end).</p>
 
+  <p>When an <code>input</code> element has a <code
+  title="attr-input-pattern">pattern</code> attribute specified,
+  authors should include a <code title="attr-title">title</code>
+  attribute to give a description of the pattern. User agents may use
+  the contents of this attribute, if it is present, when informing the
+  user that the pattern is not matched, or at any other suitable time,
+  such as in a tooltip or read out by assistive technology when the
+  control gains focus.</p>
 
+  <div class="example">
+   <p>For example, the following snippet:</p>
+   <pre>
+&lt;label&gt; Part number:
+ &lt;input pattern="[0-9][A-Z]{3}" name="part"
+        title="A part number is a digit followed by three uppercase letters."/&gt;
+&lt;/label&gt;
+</pre>
+   <p>...could cause the UA to display an alert such as:</p>
+   <pre><samp> part number is a digit followed by three uppercase letters.
+You cannot complete this form until the field is correct.</samp></pre>
+  </div>
+
+  <p>When a control has a <code>pattern</code> attribute, the
+  <code>title</code> attribute, if used, must describe the pattern.
+  Additional information could also be included, so long as it assists
+  the user in filling in the control. Otherwise, assistive technology
+  would be impaired.</p>
+
+  <p class="example">For instance, if the title attribute contained
+  the caption of the control, assistive technology could end up saying
+  something like <samp>The text you have entered does not match the
+  required pattern. Birthday</samp>, which is not useful.</p>
+
+  <p>UAs may still show the <code>title</code> in non-error situations
+  (for example, as a tooltip when hovering over the control), so
+  authors should be careful not to word <code>title</code>s as if an
+  error has necessarily occurred.</p>
+
+
+
   <h6>The <code title="attr-input-min">min</code> and <code
   title="attr-input-max">max</code> attributes</h6>
 
@@ -30870,13 +30909,15 @@
   <p>An element can be constrained in various ways. The following is
   the list of <dfn>validity states</dfn> that a form control can be
   in, making the control invalid for the purposes of constraint
-  valiation:</p>
+  validation. (The definitions below are non-normative; other parts of
+  this specification define more precisely when each state applies or
+  does not.)</p>
 
   <dl>
 
    <dt> <dfn>Suffering from being missing</dfn> </dt>
 
-   <dd> <p>When a control has no <span
+   <dd> <p class="note">When a control has no <span
    title="concept-fe-value">value</span> but has a <code
    title="">required</code> attribute (<code>input</code> <code
    title="attr-input-required">required</code>, <code>textarea</code>
@@ -30884,20 +30925,20 @@
 
    <dt> <dfn>Suffering from a type mismatch</dfn> </dt>
 
-   <dd> <p>When a control that allows arbitrary user input has a <span
+   <dd> <p class="note">When a control that allows arbitrary user input has a <span
    title="concept-fe-value">value</span> that is not in the correct
    syntax (<span title="attr-input-type-email">E-mail</span>, <span
    title="attr-input-type-url">URL</span>). </p></dd>
 
    <dt> <dfn>Suffering from a pattern mismatch</dfn> </dt>
 
-   <dd> <p>When a control has a <span
+   <dd> <p class="note">When a control has a <span
    title="concept-fe-value">value</span> that doesn't satisfy the
    <code title="attr-input-pattern">pattern</code> attribute.</p></dd>
 
    <dt> <dfn>Suffering from being too long</dfn> </dt>
 
-   <dd> <p>When a control has a <span
+   <dd> <p class="note">When a control has a <span
    title="concept-fe-value">value</span> that is too long for the
    <span title="attr-fe-maxlength">form control <code
    title="">maxlength</code> attribute</span> (<code>input</code>
@@ -30907,32 +30948,38 @@
 
    <dt> <dfn>Suffering from an underflow</dfn> </dt>
 
-   <dd> <p>When a control has a <span
+   <dd> <p class="note">When a control has a <span
    title="concept-fe-value">value</span> that is too low for the <code
    title="attr-input-min">min</code> attribute.</p></dd>
 
    <dt> <dfn>Suffering from an overflow</dfn> </dt>
 
-   <dd> <p>When a control has a <span
+   <dd> <p class="note">When a control has a <span
    title="concept-fe-value">value</span> that is too high for the
    <code title="attr-input-max">max</code> attribute.</p></dd>
 
    <dt> <dfn>Suffering from a step mismatch</dfn> </dt>
 
-   <dd> <p>When a control has a <span
+   <dd> <p class="note">When a control has a <span
    title="concept-fe-value">value</span> that doesn't fit the rules
    given by the <code title="attr-input-step">step</code>
    attribute.</p></dd>
 
    <dt> <dfn>Suffering from a custom error</dfn> </dt>
 
-   <dd> <p>When a control's <span>custom validity error message</span>
+   <dd> <p class="note">When a control's <span>custom validity error message</span>
    (as set by the element's <code
    title="dom-cva-setCustomValidity">setCustomValidity()</code>
    method) is not the empty string.</p> </dd>
 
   </dl>
 
+  <p class="note">An element can still suffer from these states even
+  when the element is <span
+  title="concept-fe-disabled">disabled</span>; thus these states can
+  be represented in the DOM even if validating the form during
+  submission wouldn't indicate a problem to the user.</p>
+
   <p>An element <dfn title="concept-fv-valid">satisfies its
   constraints</dfn> if it is not suffering from any of the above
   <span>validity states</span>.</p>

|