@@ -59,6 +59,8 @@ function BugForm() {
59
59
this . descField . on ( 'focus' , _ . bind ( this . checkProblemTypeValidity , this ) ) ;
60
60
this . problemType . on ( 'change' , _ . bind ( this . checkProblemTypeValidity , this ) ) ;
61
61
this . uploadField . on ( 'change' , _ . bind ( this . checkImageTypeValidity , this ) ) ;
62
+ this . osField . add ( this . browserField )
63
+ . on ( 'blur input' , _ . bind ( this . checkOptionalNonEmpty , this ) ) ;
62
64
this . submitButtons . on ( 'click' , _ . bind ( function ( e ) {
63
65
if ( e . target && e . target . value ) {
64
66
// store a reference to what report button was clicked
@@ -197,6 +199,19 @@ function BugForm() {
197
199
}
198
200
} ;
199
201
202
+ /* Check if Browser and OS are empty or not, only
203
+ so we can set them to valid (there is no invalid state) */
204
+ this . checkOptionalNonEmpty = function ( ) {
205
+ _ . forEach ( [ this . browserField , this . osField ] , _ . bind ( function ( input ) {
206
+ var inputId = input . prop ( 'id' ) ;
207
+ if ( input . val ( ) ) {
208
+ this . makeValid ( inputId ) ;
209
+ } else {
210
+ this . makeInvalid ( inputId ) ;
211
+ }
212
+ } , this ) ) ;
213
+ } ;
214
+
200
215
this . checkForm = function ( ) {
201
216
// Run through and see if there's any user input in the
202
217
// required inputs
@@ -208,6 +223,7 @@ function BugForm() {
208
223
this . checkURLValidity ( ) ;
209
224
this . checkProblemTypeValidity ( ) ;
210
225
this . checkImageTypeValidity ( ) ;
226
+ this . checkOptionalNonEmpty ( ) ;
211
227
// and open the form, if it's not already open
212
228
if ( ! this . reportButton . hasClass ( 'is-open' ) ) {
213
229
this . reportButton . click ( ) ;
0 commit comments