From c18e76e1cd468d37e7eee853e8916cba7afab64b Mon Sep 17 00:00:00 2001 From: mertsincan Date: Fri, 29 Jul 2022 02:40:13 +0100 Subject: [PATCH] Refactor #2811 --- src/components/dropdown/Dropdown.vue | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/components/dropdown/Dropdown.vue b/src/components/dropdown/Dropdown.vue index 2e50b6a01..be2a04d50 100755 --- a/src/components/dropdown/Dropdown.vue +++ b/src/components/dropdown/Dropdown.vue @@ -3,10 +3,10 @@ - - {{label === 'p-emptylabel' ? ' ' : label ||'empty'}} + {{label === 'p-emptylabel' ? ' ' : label || 'empty'}}
@@ -52,6 +52,9 @@ {{emptyMessageText}} + + {{emptyMessageText}} + {{selectedMessageText}} @@ -257,12 +260,16 @@ export default { isFocus && this.$refs.focusInput.focus(); }, hide(isFocus) { - this.$emit('before-hide'); - this.overlayVisible = false; - this.focusedOptionIndex = -1; - this.searchValue = ''; + const _hide = () => { + this.$emit('before-hide'); + this.overlayVisible = false; + this.focusedOptionIndex = -1; + this.searchValue = ''; - isFocus && this.$refs.focusInput.focus(); + isFocus && this.$refs.focusInput.focus(); + } + + setTimeout(() => { _hide() }, 0); // For ScreenReaders }, onFocus(event) { this.focused = true; @@ -771,7 +778,7 @@ export default { }, listRef(el, contentRef) { this.list = el; - contentRef && contentRef(el); // for virtualScroller + contentRef && contentRef(el); // For VirtualScroller }, virtualScrollerRef(el) { this.virtualScroller = el; @@ -855,7 +862,7 @@ export default { return this.emptySelectionMessage || this.$primevue.config.locale.emptySelectionMessage; }, selectedMessageText() { - return ObjectUtils.isNotEmpty(this.modelValue) ? this.selectionMessageText.replaceAll('{0}', this.modelValue.length) : this.emptySelectionMessageText; + return ObjectUtils.isNotEmpty(this.modelValue) ? this.selectionMessageText.replaceAll('{0}', '1') : this.emptySelectionMessageText; }, focusedOptionId() { return this.focusedOptionIndex !== -1 ? `${this.id}_${this.focusedOptionIndex}` : null;