Merge pull request #3946 from primefaces/issue-3870

OrderList: change focus index method fixed for empty items cases
pull/3958/head
Tuğçe Küçükoğlu 2023-05-11 15:45:34 +03:00 committed by GitHub
commit 56087ac28f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -347,8 +347,8 @@ export default {
let order = index >= items.length ? items.length - 1 : index < 0 ? 0 : index; let order = index >= items.length ? items.length - 1 : index < 0 ? 0 : index;
this.focusedOptionIndex = items[order].getAttribute('id'); this.focusedOptionIndex = items[order] ? items[order].getAttribute('id') : -1;
this.scrollInView(items[order].getAttribute('id')); this.scrollInView(this.focusedOptionIndex);
}, },
scrollInView(id) { scrollInView(id) {
const element = DomHandler.findSingle(this.list, `li[id="${id}"]`); const element = DomHandler.findSingle(this.list, `li[id="${id}"]`);