From b92cb2373cacf35dde1ee21332ea499d5c0daf29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87etin?= <69278826+cetincakiroglu@users.noreply.github.com> Date: Wed, 7 Feb 2024 13:10:25 +0300 Subject: [PATCH] refactor on https://github.com/primefaces/primeng/commit/de3ffd6525e38e08392347e509915a395ed6f36f --- src/app/components/dropdown/dropdown.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/components/dropdown/dropdown.ts b/src/app/components/dropdown/dropdown.ts index ba0bc0ab10c..8304c44e477 100755 --- a/src/app/components/dropdown/dropdown.ts +++ b/src/app/components/dropdown/dropdown.ts @@ -1451,7 +1451,7 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV break; case 'Enter': - this.onEnterKey(event); + this.onEnterKey(event, true); break; case 'Escape': @@ -1660,7 +1660,7 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV !this.editable && !pressedInInputText && this.onEnterKey(event); } - onEnterKey(event) { + onEnterKey(event, pressedInInput = false) { if (!this.overlayVisible) { this.focusedOptionIndex.set(-1); this.onArrowDownKey(event); @@ -1669,6 +1669,8 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV const option = this.visibleOptions()[this.focusedOptionIndex()]; this.onOptionSelect(event, option); } + + !pressedInInput && this.hide(); } event.preventDefault();