Skip to content

Loading…

Safari 6 <input required> #697

Closed
jbrooksuk opened this Issue · 8 comments

4 participants

@jbrooksuk

Safari 6 and Safari Mobile on iOS6 both believe they can support <input required> however they don't, the form will submit regardless.

Moderinzr.input.required actually reports true as seen at my demo page.

@paulirish
Modernizr member
@paulirish
Modernizr member
@paulirish
Modernizr member
@jbrooksuk

@paulirish absolutely, I'll get on and report it now.

I never knew that Chrome had a separate handler for this, that's rather interesting!

@jbrooksuk

Reported hope it makes sense.

@aFarkas
Modernizr member

While it lookes like a bug in Modernizr it is not. Modernizr only tests the API for required, which is working. Even, if we would test, wether an empy required field is valid, Safari would pass the test.

The sad truth is, that HTML5 forms features are fragmented. Safari 5.0.0 has included very odd support for interactive form validation, removed it in 5.0.2 and hasn't done anything for Safari 6. In case you want to know wether the required API works. Modernizr.input.required is still valid. If you want to know wether interactive form validation works, Modernizr provides a different test, which is located here: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/forms-validation.js

This test provides you with following informations:

  • Modernizr.formvalidation (false in Safari and "other old" browsers like IE9-, FF3.6-)
  • Modernizr.formvalidationapi (false in old browsers)
  • Modernizr.formvalidationmessage (false in Opera 12 and "other old" browsers)

The Modernizr.formvalidation is treated as the main test and also adds classes to the html element. The both other tests are only included as JS flags.

Note, that this test also detects, if form validation is manually disabled in Chrome (about:flags ...).

@aFarkas aFarkas closed this
@aFarkas aFarkas reopened this
@aFarkas
Modernizr member

@darrrk

Many thanks for spotting this issue.

@aFarkas aFarkas closed this in 72b3d79
@SlexAxton SlexAxton added a commit to SlexAxton/Modernizr that referenced this issue
@SlexAxton SlexAxton Merge branch 'master' of github.com:Modernizr/Modernizr
* 'master' of github.com:Modernizr/Modernizr:
  history check should check for Android 2
  made check a little clearer, removing a nested if statement
  only check for version of Android between 2 and 3
  #733: adding UA sniff for history support
  use addEventListener instead of DOM level 1 events (fixes #697)
  only check for version of Android between 2 and 3
  #733: adding UA sniff for history support
21f4d67
@patrickkettner patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this issue
@aFarkas aFarkas use addEventListener instead of DOM level 1 events (fixes #697) 07e449a
@patrickkettner patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this issue
@SlexAxton SlexAxton Merge branch 'master' of github.com:Modernizr/Modernizr
* 'master' of github.com:Modernizr/Modernizr:
  history check should check for Android 2
  made check a little clearer, removing a nested if statement
  only check for version of Android between 2 and 3
  #733: adding UA sniff for history support
  use addEventListener instead of DOM level 1 events (fixes #697)
  only check for version of Android between 2 and 3
  #733: adding UA sniff for history support
9914f33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.