Skip to content

Commit 2a5d6bb

Browse files
susnuxmarcelklehr
authored andcommitted
fix(files): Reset context menu position on close
* Resolves #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 <opensource@fthiessen.de>
1 parent 87605dd commit 2a5d6bb

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

apps/files/src/components/FileEntryMixin.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,23 @@ export default defineComponent({
211211
this.resetState()
212212
}
213213
},
214+
215+
openedMenu() {
216+
if (this.openedMenu === false) {
217+
// TODO: This timeout can be removed once `close` event only triggers after the transition
218+
// ref: https://github.com/nextcloud-libraries/nextcloud-vue/pull/6065
219+
window.setTimeout(() => {
220+
if (this.openedMenu) {
221+
// was reopened while the animation run
222+
return
223+
}
224+
// Reset any right menu position potentially set
225+
const root = this.$el?.closest('main.app-content') as HTMLElement
226+
root.style.removeProperty('--mouse-pos-x')
227+
root.style.removeProperty('--mouse-pos-y')
228+
}, 300)
229+
}
230+
},
214231
},
215232

216233
beforeDestroy() {

0 commit comments

Comments
 (0)