Closed
Bug 1513890
Opened 6 years ago
Closed 6 years ago
Remove 'x-moz-errormessage' attribute
Categories
(Core :: DOM: Core & HTML, enhancement, P2)
Core
DOM: Core & HTML
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)
5.85 KB,
patch
|
edgar
:
review+
|
Details | Diff | Splinter Review |
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.
Updated•6 years ago
|
Keywords: dev-doc-needed
Comment 1•6 years ago
|
||
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.
Updated•6 years ago
|
Keywords: site-compat
Comment 2•6 years ago
|
||
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
Assignee | ||
Comment 3•6 years ago
|
||
Attachment #9031373 -
Flags: review?(bugs)
Updated•6 years ago
|
Attachment #9031373 -
Flags: review?(bugs) → review?(echen)
Updated•6 years ago
|
Priority: -- → P2
Comment 4•6 years ago
|
||
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
Comment 6•6 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
Comment 7•6 years ago
|
||
Posted site compatibility note: https://www.fxsitecompat.com/en-CA/docs/2018/x-moz-errormessage-attribute-is-no-longer-supported/
Comment 8•6 years ago
|
||
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!
Keywords: dev-doc-needed → dev-doc-complete
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•