From a8c5aa045b9ba4bfea2ad9e2a010bdcc783cc2aa Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Tue, 6 Feb 2024 19:40:32 +0100 Subject: [PATCH] fix(NcActions): close menu only on the next tick Signed-off-by: Grigorii K. Shartsev --- src/components/NcActions/NcActions.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/NcActions/NcActions.vue b/src/components/NcActions/NcActions.vue index 4cc89fd00b..62335be1e9 100644 --- a/src/components/NcActions/NcActions.vue +++ b/src/components/NcActions/NcActions.vue @@ -1249,11 +1249,16 @@ export default { */ this.$emit('open') }, - closeMenu(returnFocus = true) { + async closeMenu(returnFocus = true) { if (!this.opened) { return } + // Wait for the next tick to keep the menu in DOM, allowing other components to find what button in what menu was used, + // for example, to implement auto set return focus. + // NcPopover will actually remove the menu from DOM also on the next tick. + await this.$nextTick() + this.opened = false this.$refs.popover.clearFocusTrap({ returnFocus })