HTMLButtonElement - setCustomValidity(): Specify button type availability
- Dominant language
- Markdown
- Stars
- 11k
- Forks
- 23.2k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 331
Description
### MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/setCustomValidity
### What specific section or headline is this issue about?
_No response_
### What information was incorrect, unhelpful, or incomplete?
Subsequent to spending a few hours testing and looking for the relevant information, I found out from `#dom:mozilla.org` that the specification only allows `HTMLButtonElement: setCustomValidity()` method for `button type="submit"`.
It would be beneficial to include the information on MDN to prevent further confusion.
Similarly, [HTMLButtonElement: reportValidity()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/reportValidity) would benefit from further clarification, as given in [HTMLFieldSetElement: reportValidity()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFieldSetElement/reportValidity)
> It always returns true because [``](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/fieldset) elements are never candidates for [constraint validation](https://developer.mozilla.org/en-US/docs/Web/HTML/Guides/Constraint_validation).
Ref: [Constraint validation](https://html.spec.whatwg.org/#:~:text=Constraint%20validation%3A%20If%20the%20element%20is%20not%20a%20submit%20button%2C%20the%20element%20is%20barred%20from%20constraint%20validation%2E)
### What did you expect to see?
A notice to say that method only produces a visual effect for `button type="submit"`
### Do you have any supporting links, references, or citations?
_No response_
### Do you have anything more you want to share?
_No response_
### MDN metadata
Page report details
* Folder: `en-us/web/api/htmlbuttonelement/setcustomvalidity`
* MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/setCustomValidity
* GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/api/htmlbuttonelement/setcustomvalidity/index.md
* Last commit: https://github.com/mdn/content/commit/e9b6cd1b7fa8612257b72b2a85a96dd7d45c0200
* Document last modified: 2025-04-10T14:56:07.000Z
Contributor guide
Assessment
This issue has not been assessed yet.