Skip to content

Commit b404c3e

Browse files
committed
fix(NcActions): allow to close popover when clicking outside
- #6892 Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent f8d01cf commit b404c3e

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/components/NcActions/NcActions.vue

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,6 +1300,14 @@ export default {
13001300
},
13011301
13021302
// MENU STATE MANAGEMENT
1303+
toggleMenu(state) {
1304+
if (state) {
1305+
this.openMenu()
1306+
} else {
1307+
this.closeMenu()
1308+
}
1309+
},
1310+
13031311
openMenu() {
13041312
if (this.opened) {
13051313
return
@@ -1760,20 +1768,21 @@ export default {
17601768
{
17611769
ref: 'popover',
17621770
delay: 0,
1763-
handleResize: true,
17641771
shown: this.opened,
17651772
placement: this.placement,
17661773
boundary: this.boundariesElement,
17671774
container: this.container,
1768-
...this.manualOpen && { triggers: [] },
1775+
...this.manualOpen && {
1776+
triggers: [],
1777+
},
1778+
closeOnClickOutside: !this.manualOpen,
17691779
popoverBaseClass: 'action-item__popper',
17701780
popupRole: this.config.popupRole,
1771-
setReturnFocus: this.config.withFocusTrap ? this.$refs.triggerButton?.$el : null,
1781+
setReturnFocus: this.config.withFocusTrap ? this.$refs.triggerButton?.$el : undefined,
17721782
focusTrap: this.config.withFocusTrap,
1773-
onShow: this.openMenu,
1783+
'onUpdate:shown': this.toggleMenu,
17741784
onAfterShow: this.onOpened,
17751785
onAfterClose: this.onClosed,
1776-
onHide: this.closeMenu,
17771786
},
17781787
{
17791788
trigger: () => h(NcButton, {

0 commit comments

Comments
 (0)