From 00a87d28bb9f1ee2ddd4ec76e177fa0d39d6d486 Mon Sep 17 00:00:00 2001 From: Marco 'Lubber' Wienkoop Date: Tue, 12 Nov 2019 16:28:06 +0100 Subject: [PATCH] fix(dropdown): remove required attribute from select When a dropdown was initialized out of a select tag and that tag had the 'required' attribute set, it is not possible to submit the form with an empty value, because the select-tag stays hidden. Instead a console warning is shown "An invalid form control with name='' is not focusable" Basically we could argue "Just don't add 'required' to the select tag and use FUI form validation instead". But there might be situations where the form is generated by some backend framework where the "required" attribute is set automatically, thus i just removed the required attribute in any case as a proposal to solve the situation. This PR possibly breaks existing code, in case some developer have used the "required" attribute explicitly to gain the current behavior (and don't care about the console warning) Closes #917 --- src/definitions/modules/dropdown.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index 89538abd83..49b3db648d 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -397,6 +397,7 @@ $.fn.dropdown = function(parameters) { $module.addClass(className.disabled); } $input + .removeAttr('required') .removeAttr('class') .detach() .prependTo($module)