1513890 - Remove 'x-moz-errormessage' attribute
Closed Bug 1513890 Opened 6 years ago Closed 6 years ago

Remove 'x-moz-errormessage' attribute

Categories

(Core :: DOM: Core & HTML, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: baku, Assigned: baku)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, site-compat)

Attachments

(1 file)

x-moz-errormessage attribute can be used to have a custom error message when validating a form field. This is a mozilla-only attribute which was rejected in 2010 by w3: https://www.w3.org/Bugs/Public/show_bug.cgi?id=10923 Currently, a similar message can be set using setCustomValidity() method: https://html.spec.whatwg.org/#dom-cva-setcustomvalidity This bug is about removing the support for this attribute.
There are web pages hinting about this attribute, some pages say that title attribute would work the same way in some browsers. Better to verify how title attribute works elsewhere.
Keywords: site-compat
Hmm… I could have used this recently for Web Payments UI if I had known about it. (In reply to Olli Pettay [:smaug] (high review load) from comment #1) > There are web pages hinting about this attribute, some pages say that title > attribute would work the same way in some browsers. Better to verify how > title attribute works elsewhere. It sounds like Blink used to use @title to override the custom message but stopped doing so years ago. We currently only use @title with @pattern and a problem is that we append our own string[1] to the @title but that's often not ideal. For example, UX wanted us to show the message "Enter a valid ZIP code for the country or region" but if we did: > <input pattern="[0-9]{5}" title="Enter a valid ZIP code for the country or region"> leads to > Please match the requested format: Enter a valid ZIP code for the country or region which isn't great. In our case we were already using `setCustomValidity` for another class of errors and it would have been a lot of work to re-implement @pattern and the other constraint attributes with `setCustomValidity` just to handle changing the message to remove the "Please match the requested format: " prefix. For complicated forms it seems like a way to override the message shown while invalid without actually marking the field as invalid, like x-moz-errormessage, is still useful. [1] https://dxr.mozilla.org/mozilla-central/rev/c2593a3058afdfeaac5c990e18794ee8257afe99/dom/locales/en-US/chrome/dom/dom.properties#45-46
Attached patch validation.patchSplinter Review
Attachment #9031373 - Flags: review?(bugs)
Attachment #9031373 - Flags: review?(bugs) → review?(echen)
Priority: -- → P2
Comment on attachment 9031373 [details] [diff] [review] validation.patch Review of attachment 9031373 [details] [diff] [review]: ----------------------------------------------------------------- Looks good to me.
Attachment #9031373 - Flags: review?(echen) → review+
Pushed by amarchesini@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/6533f8297b30 Get rid of x-moz-errormessage attribute, r=edgar
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66

I've documented this:

mentioned that the attribute is removed in 66, and added an example of what you should do instead, to
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Custom_error_messages

Removed any mention of the attribute from
https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation

Added compat data:
https://github.com/mdn/browser-compat-data/pull/3364

Added a note to the Fx66 rel notes:
https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/66#HTML

Let me know if that's OK, thanks!

Component: DOM → DOM: Core & HTML
Blocks: 1294413
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: