Skip to content

Commit

Permalink
fix(dropdown): remove required attribute from select
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lubber-de committed Nov 12, 2019
1 parent 060ee89 commit 00a87d2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/definitions/modules/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ $.fn.dropdown = function(parameters) {
$module.addClass(className.disabled);
}
$input
.removeAttr('required')
.removeAttr('class')
.detach()
.prependTo($module)
Expand Down

0 comments on commit 00a87d2

Please sign in to comment.