Problem/Motivation
It seems the required attribute does nothing on file inputs.
This could be a problem for #2847425: #states not affecting visibility/requirement of managed_file and #2938441: managed_file HTML5 required validation , these issues will add new ways to have this attribute on input fields so it needs to do something.
This seems to happen because disableFields() in file.js disables every input field when submitting the form, so the required attribute is not triggered by the browser.
I suppose there is a good reason to do this but it could probably be improved.
Steps to reproduce
Override the input--file.html.twig template to add the required attribute on file inputs.
Add a file field on a node bundle.
Browse to the create form for this bundle.
Leave the file field empty and click on Save: the browser does not prevent submitting the form.
Comments
Comment #2
prudloff commentedComment #3
kim.pepperI know there is an existing issue about this somewhere but I can't find it.