Skip to content

Commit 70a6e32

Browse files
authored
Merge pull request primefaces#3037 from jxmai/PF_3029
Fix primefaces#3029 - strengthen the focus function in core.js
2 parents 1111593 + fb5fde1 commit 70a6e32

File tree

1 file changed

+13
-12
lines changed
  • src/main/resources/META-INF/resources/primefaces/core

1 file changed

+13
-12
lines changed

src/main/resources/META-INF/resources/primefaces/core/core.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -409,16 +409,7 @@
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.focusElement(firstElement);
422413
}
423414
}, 50);
424415

@@ -428,8 +419,18 @@
428419
},
429420

430421
focusElement: function(el) {
431-
if(el.is(':radio') && el.hasClass('ui-helper-hidden-accessible')) {
432-
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+
}
433434
}
434435
else {
435436
el.focus();

0 commit comments

Comments
 (0)