Skip to content

Commit

Permalink
Fix primefaces#1879: Input focus() should not scroll unless autoFocus…
Browse files Browse the repository at this point in the history
…=true
  • Loading branch information
melloware committed Apr 22, 2022
1 parent 5f1988b commit c2bb17f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/lib/utils/DomHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,8 @@ export default class DomHandler {
* @param {boolean} autoFocus flag to control whether to scroll to the element, false by default
*/
static focus(inputRef, autoFocus) {
const scroll = ObjectUtils.isEmpty(autoFocus) ? true : !autoFocus;
inputRef && inputRef.current && inputRef.current.focus({ preventScroll: scroll });
const preventScroll = ObjectUtils.isEmpty(autoFocus) ? true : !autoFocus;
inputRef && inputRef.current && inputRef.current.focus({ preventScroll: preventScroll });
}

static getCursorOffset(el, prevText, nextText, currentText) {
Expand Down

0 comments on commit c2bb17f

Please sign in to comment.