olton / Metro-UI-CSS

Impressive component library for expressive web development! Build responsive projects on the web with the first front-end component library in Metro Style. And now there are even more opportunities every day!
http://metroui.org.ua/
MIT License
7.02k stars 1.97k forks source link

Validator does not add invalid class to type file #1892

Open bogozaur opened 1 year ago

bogozaur commented 1 year ago

When using the validator and add required to a type="file" input with data-role="file", in case there is no file selected, the field is not marked as invalid (the invalid class is not added to the visible element). The invalid class is added directly to the input file that is hidden.

To Reproduce Create a input field:

Expected behavior The invalid class should be added to the parent of the file input element.

Where is the problem The problem is in is_control function: is_control: function(el){ return el.parent().hasClass("input") || el.parent().hasClass("select") || el.parent().hasClass("textarea") || el.parent().hasClass("checkbox") || el.parent().hasClass("switch") || el.parent().hasClass("radio") || el.parent().hasClass("spinner") ; },

The || el.parent().hasClass("file") file should be included here