From be33321059ac93e81d79e0d87c126575b839ac6b Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 9 Sep 2024 15:37:01 +0200 Subject: fix(files): Reset context menu position on close * Resolves https://github.com/nextcloud/server/issues/46934 Ensure that after a right-click the context menu position is resetted, so that pressing the "actions"-menu button it is displayed on the correct location. Signed-off-by: Ferdinand Thiessen --- apps/files/src/components/FileEntryMixin.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'apps/files/src') diff --git a/apps/files/src/components/FileEntryMixin.ts b/apps/files/src/components/FileEntryMixin.ts index f2a6f89cf22..a43cab13575 100644 --- a/apps/files/src/components/FileEntryMixin.ts +++ b/apps/files/src/components/FileEntryMixin.ts @@ -218,6 +218,23 @@ export default defineComponent({ this.resetState() } }, + + openedMenu() { + if (this.openedMenu === false) { + // TODO: This timeout can be removed once `close` event only triggers after the transition + // ref: https://github.com/nextcloud-libraries/nextcloud-vue/pull/6065 + window.setTimeout(() => { + if (this.openedMenu) { + // was reopened while the animation run + return + } + // Reset any right menu position potentially set + const root = this.$el?.closest('main.app-content') as HTMLElement + root.style.removeProperty('--mouse-pos-x') + root.style.removeProperty('--mouse-pos-y') + }, 300) + } + }, }, beforeDestroy() { -- cgit v1.2.3