diff --git a/lib/simple_form/components/html5.rb b/lib/simple_form/components/html5.rb
index 3adba41e..e0e5ea8f 100644
--- a/lib/simple_form/components/html5.rb
+++ b/lib/simple_form/components/html5.rb
@@ -16,7 +16,10 @@ module SimpleForm
end
def has_required?
- required_field?
+ # We need to check browser_validations because
+ # some browsers are still checking required even
+ # if novalidate was given.
+ required_field? && SimpleForm.browser_validations
end
end
end
diff --git a/test/inputs/collection_input_test.rb b/test/inputs/collection_input_test.rb
index 40990044..b43db5ea 100644
--- a/test/inputs/collection_input_test.rb
+++ b/test/inputs/collection_input_test.rb
@@ -249,6 +249,14 @@ class CollectionInputTest < ActionView::TestCase
assert_select 'select[required]'
end
+ test 'when not using browser validations, input should not generate required html attribute' do
+ swap SimpleForm, :browser_validations => false do
+ with_input_for @user, :name, :string
+ assert_select 'input[type=text].required'
+ assert_no_select 'input[type=text][required]'
+ end
+ end
+
test 'collection input with select type should not generate required html attribute without blank option' do
with_input_for @user, :name, :select, :include_blank => false, :collection => ['Jose' , 'Carlos']
assert_select 'select.required'