Last modified: 2013-11-20 22:58:18 UTC
Created attachment 11173 [details] browser tooltip and MediaWiki div both warning invalid email With $wgHtml5 now true on en-wiki, the form field attribute type=email in MediaWiki forms flows to the browser. This makes recent browsers validate e-mail addresses on submit. Which is fine, except when the form does its own client-side validation, in which case two validation messages appear simultaneously. See screenshot. To reproduce, visit Special:ChangeEmail, enter a bad e-mail, tab out of the field, and click [Submit] or press the [Enter] key. This may also happen with other forms using HTMl5 input types that trigger browser validation that do their own client-side validation. A workaround is to disable the browser's validation with attributes novalidate and formnovalidate; it would be better to somehow cooperate with the browser's implementation.
You can bind a listener to the browser's native 'invalid' event. When you hear it you can output your own invalidity UI and then cancel the event. Canceling the event will not disable the validation (the form will still not submit) but it will disable the browser's native UI.
Bug 40585 is also caused by HTML5 form validation (input type="number" with step="any" stripped by Html::expandAttributes() prevents client submission of non-integer numbers).
Change 96195 had a related patch set uploaded by Theopolisme: Supress native "invalid email" warning on Special:ChangeEmail https://gerrit.wikimedia.org/r/96195
Change 96195 merged by jenkins-bot: Supress native "invalid email" warning on Special:ChangeEmail https://gerrit.wikimedia.org/r/96195
Fixed by Theo as part of his GCI work. Thanks!