Open EIevations opened 1 day ago
Can you point to the change you are talking about? I've no recollection of such a change.
Can you point to the change you are talking about? I've no recollection of such a change.
Honestly, I’m not entirely sure if WHATWG has documented the exact change in its GitHub, and I’m not even certain if WHATWG had any direct influence on the decision-making behind this behavior shift. From what I’ve seen, though, it looks like the change was driven more by browsers themselves (Firefox, Chrome, Safari) rather than the HTML standard directly. Around the early 2010s, these browsers started moving away from using the title attribute to display validation error messages, opting instead for their own custom error messages. By the time HTML5 was finalized (in 2014), most browsers had fully switched over to their own error handling systems for form validation.
I found this link in the HTML Living Standard that explicitly mentions not relying on the title attribute for validation anymore, which ties into what I’m talking about:
https://html.spec.whatwg.org/multipage/dom.html#the-title-attribute
It’s a bit strange, though, that now you have to rely on JavaScript to change the validation message that appears when the required attribute is used in any HTML Form/Input field/Checkbox. It’s not something that seems to be handled directly by the title attribute anymore, which feels like a step backward in terms of simplicity and accessibility.
I hope that if it is possible for the HTML Standard to be made aware of this issue that maybe something might be done about it.
I think all browsers make use of the title
attribute when there is a pattern
attribute mismatch assuming you're talking about form validation. You're saying you would also expect it to be used when there are other mismatch conditions? I don't think that was ever part of the standard.
It might be worth considering, but some more detail would be required as to what exactly is expected here.
You're right that modern browsers still use the title attribute for error messages when there’s a pattern mismatch during form validation.
However, when it comes to other types of validation issues, such as when a "required" field is left empty, browsers have largely stopped using the title attribute to display error messages. Instead, they now show their own custom error messages and disregard the title attribute entirely.
As far as I know, the only way to override this behavior is by using JavaScript to customize the error messages. I think this approach could be reconsidered because relying on JavaScript for such a fundamental feature of form validation doesn’t seem ideal. It would be better to explore solutions that make the process more straightforward and less dependent on scripting.
I don’t believe browsers should expect developers to use JavaScript for basic form validation as a standard practice, especially when simpler solutions could be made available directly through HTML. This shift toward requiring JavaScript for form validation undermines the accessibility and simplicity that HTML5 forms were intended to offer.
I'd love to see some kind of evidence or pointer that indicates this has indeed changed as I don't recall this at all. In any event, it seems reasonable to file a feature request to provide a declarative means of setting the validation message, but at this point I think that would be best motivated in a new issue that uses the new feature template.
What is the issue with the HTML Standard?
I want to address the recent change that forces the use of JavaScript to set custom error messages with the required attribute in HTML forms. Previously, the title attribute allowed for easy customization of error messages when validation failed, but modern browsers no longer support this behavior. Instead, developers are now required to write additional JavaScript code just to display a custom message.
The argument that allowing the title attribute to control error messages caused inconsistency across browsers is, quite frankly, nonsensical. Website owners who need custom error messages would be explicitly setting them in the first place. This change seems unnecessary, as it doesn't address any real issue but instead introduces additional complexity, requiring unnecessary JavaScript for something that could be easily managed with plain HTML.
Forcing developers to rely on JavaScript for such a basic feature only increases the potential for security vulnerabilities and adds extra overhead to the form-handling process. The idea that keeping the title attribute would cause inconsistencies is misleading—those who want custom messages would be controlling them anyway, ensuring consistency through their own implementation.
I strongly believe that returning the ability to customize validation messages using the title attribute would simplify form validation, improve accessibility, and remove the need for external scripts. This decision should be revisited to prioritize developer flexibility without compromising on security or usability.