From 851103fac920730ca4764627faca56962fc130ce Mon Sep 17 00:00:00 2001 From: Kadir Boylu Date: Sun, 29 Oct 2023 14:46:20 +0300 Subject: [PATCH 1/2] fix: overlaypanel only be closed on escape key pressed #4712 https://github.com/primefaces/primevue/issues/4712 --- components/lib/overlaypanel/OverlayPanel.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/lib/overlaypanel/OverlayPanel.vue b/components/lib/overlaypanel/OverlayPanel.vue index 19fdcc1deb..7d9e04edf6 100755 --- a/components/lib/overlaypanel/OverlayPanel.vue +++ b/components/lib/overlaypanel/OverlayPanel.vue @@ -139,6 +139,7 @@ export default { this.unbindOutsideClickListener(); this.unbindScrollListener(); this.unbindResizeListener(); + this.unbindDocumentKeyDownListener(); OverlayEventBus.off('overlay-click', this.overlayEventListener); this.overlayEventListener = null; this.$emit('hide'); @@ -192,7 +193,7 @@ export default { } }, onKeyDown(event) { - if (event.code === 'Escape' || this.closeOnEscape) { + if (event.code === 'Escape' && this.closeOnEscape) { this.visible = false; } }, From 5e1e7daeb75f871215afc08f15330de6b87033bf Mon Sep 17 00:00:00 2001 From: Kadir Boylu Date: Mon, 30 Oct 2023 14:13:17 +0300 Subject: [PATCH 2/2] fix: add closeOnEscape for onContentKeydown #4712 https://github.com/primefaces/primevue/issues/4712 --- components/lib/overlaypanel/OverlayPanel.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lib/overlaypanel/OverlayPanel.vue b/components/lib/overlaypanel/OverlayPanel.vue index 7d9e04edf6..b25749a808 100755 --- a/components/lib/overlaypanel/OverlayPanel.vue +++ b/components/lib/overlaypanel/OverlayPanel.vue @@ -168,7 +168,7 @@ export default { } }, onContentKeydown(event) { - if (event.code === 'Escape') { + if (event.code === 'Escape' && this.closeOnEscape) { this.hide(); DomHandler.focus(this.target); }