File tree Expand file tree Collapse file tree 1 file changed +16
-12
lines changed
src/main/resources/META-INF/resources/primefaces/core Expand file tree Collapse file tree 1 file changed +16
-12
lines changed Original file line number Diff line number Diff line change 399399 }
400400 else {
401401 var firstElement = jq . find ( selector ) . eq ( 0 ) ;
402- PrimeFaces . focusElement ( firstElement ) ;
402+ PrimeFaces . focusFirstElement ( firstElement ) ;
403403 }
404404 }
405405 else if ( context ) {
406406 var firstElement = $ ( PrimeFaces . escapeClientId ( context ) ) . find ( selector ) . eq ( 0 ) ;
407- PrimeFaces . focusElement ( firstElement ) ;
407+ PrimeFaces . focusFirstElement ( firstElement ) ;
408408 }
409409 else {
410410 var elements = $ ( selector ) ,
411411 firstElement = elements . eq ( 0 ) ;
412- if ( firstElement . is ( ':radio' ) ) {
413- var checkedRadio = $ ( ':radio[name="' + firstElement . attr ( 'name' ) + '"]' ) . filter ( ':checked' ) ;
414- if ( checkedRadio . length )
415- PrimeFaces . focusElement ( checkedRadio ) ;
416- else
417- PrimeFaces . focusElement ( firstElement ) ;
418- }
419- else {
420- firstElement . focus ( ) ;
421- }
412+ PrimeFaces . focusFirstElement ( firstElement ) ;
422413 }
423414 } , 50 ) ;
424415
427418 PrimeFaces . customFocus = true ;
428419 } ,
429420
421+ focusFirstElement : function ( firstElement ) {
422+ if ( firstElement . is ( ':radio' ) ) {
423+ var checkedRadio = $ ( ':radio[name="' + firstElement . attr ( 'name' ) + '"]' ) . filter ( ':checked' ) ;
424+ if ( checkedRadio . length )
425+ PrimeFaces . focusElement ( checkedRadio ) ;
426+ else
427+ PrimeFaces . focusElement ( firstElement ) ;
428+ }
429+ else {
430+ firstElement . focus ( ) ;
431+ }
432+ } ,
433+
430434 focusElement : function ( el ) {
431435 if ( el . is ( ':radio' ) && el . hasClass ( 'ui-helper-hidden-accessible' ) ) {
432436 el . parent ( ) . focus ( ) ;
You can’t perform that action at this time.
0 commit comments