[whatwg] Constraint Validation and the title Attribute
TJ VanToll
tj.vantoll at gmail.com
Thu Jan 2 10:22:51 PST 2014
Hello all,
I have a question related to showing the title attribute when constraint validation issues occur during a form submission.
In the current spec, the title attribute is only mentioned in relation to the pattern attribute:
"When an input element has a pattern attribute specified, authors should include a title 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." (http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#attr-input-pattern)
All browsers that have implemented the constraint validation API correctly follow this. However Blink takes this behavior one step farther; it displays the title attribute for any invalid constraint - not just pattern mismatches. For instance Blink will show this <input>'s title attribute in its message bubble.
<form>
<input required title="hello world">
<button>Submit</button>
</form>
I am wondering if Blink's behavior - always showing the title attribute - can be made the standard. The use case here is supplying additional, contextual information to the user - on top of the very generic message the user agent provides. While this is most valuable when using the pattern attribute, it can be handy for even simple required fields.
<input type="email" required title="We need your email address to reset your account if you forget your password.">
Adding this information to the validationMessage using the current APIs requires some non-trivial JavaScript (see http://jsfiddle.net/tj_vantoll/p2dT5/), and I think this would be a nice feature to have consistently implemented.
My apologizes if this has come up before, but I couldn't find anything to explain the implementation difference between Blink and other rendering engines.
Thanks,
TJ VanToll
More information about the whatwg
mailing list