File tree Expand file tree Collapse file tree 1 file changed +15
-18
lines changed
src/main/resources/META-INF/resources/primefaces/core Expand file tree Collapse file tree 1 file changed +15
-18
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 . focusFirstElement ( firstElement ) ;
402+ PrimeFaces . focusElement ( firstElement ) ;
403403 }
404404 }
405405 else if ( context ) {
406406 var firstElement = $ ( PrimeFaces . escapeClientId ( context ) ) . find ( selector ) . eq ( 0 ) ;
407- PrimeFaces . focusFirstElement ( firstElement ) ;
407+ PrimeFaces . focusElement ( firstElement ) ;
408408 }
409409 else {
410410 var elements = $ ( selector ) ,
411411 firstElement = elements . eq ( 0 ) ;
412- PrimeFaces . focusFirstElement ( firstElement ) ;
412+ PrimeFaces . focusElement ( firstElement ) ;
413413 }
414414 } , 50 ) ;
415415
418418 PrimeFaces . customFocus = true ;
419419 } ,
420420
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-
434421 focusElement : function ( el ) {
435- if ( el . is ( ':radio' ) && el . hasClass ( 'ui-helper-hidden-accessible' ) ) {
436- el . parent ( ) . focus ( ) ;
422+ if ( el . is ( ':radio' ) ) {
423+ // github issue: #2582
424+ if ( el . hasClass ( 'ui-helper-hidden-accessible' ) ) {
425+ el . parent ( ) . focus ( ) ;
426+ }
427+ else {
428+ var checkedRadio = $ ( ':radio[name="' + el . attr ( 'name' ) + '"]' ) . filter ( ':checked' ) ;
429+ if ( checkedRadio . length )
430+ checkedRadio . focus ( ) ;
431+ else
432+ el . focus ( ) ;
433+ }
437434 }
438435 else {
439436 el . focus ( ) ;
You can’t perform that action at this time.
0 commit comments