From 61281c28949355e5ae0e02470be70f8cbe63d608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=87etin?= <92744169+mehmetcetin01140@users.noreply.github.com> Date: Tue, 26 Nov 2024 12:56:56 +0300 Subject: [PATCH] Fixed #16847- MultiSelect | Set the default value of autoOptionFocus to false --- packages/primeng/src/multiselect/multiselect.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/primeng/src/multiselect/multiselect.ts b/packages/primeng/src/multiselect/multiselect.ts index cd5924d09ef..60b440f69be 100755 --- a/packages/primeng/src/multiselect/multiselect.ts +++ b/packages/primeng/src/multiselect/multiselect.ts @@ -889,7 +889,7 @@ export class MultiSelect extends BaseComponent implements OnInit, AfterViewInit, * Whether to focus on the first visible or selected element when the overlay panel is shown. * @group Props */ - @Input({ transform: booleanAttribute }) autoOptionFocus: boolean = true; + @Input({ transform: booleanAttribute }) autoOptionFocus: boolean = false; /** * Callback to invoke when value changes. * @param {MultiSelectChangeEvent} event - Custom change event. @@ -2049,7 +2049,8 @@ export class MultiSelect extends BaseComponent implements OnInit, AfterViewInit, */ public show(isFocus?) { this.overlayVisible = true; - const focusedOptionIndex = this.focusedOptionIndex() !== -1 ? this.focusedOptionIndex() : this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1; + + const focusedOptionIndex = this.focusedOptionIndex() !== -1 ? this.focusedOptionIndex() : this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : this.findSelectedOptionIndex(); this.focusedOptionIndex.set(focusedOptionIndex); if (isFocus) {