Skip to content

Commit

Permalink
fix(files): Reset context menu position on close
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
susnux authored and marcelklehr committed Sep 11, 2024
1 parent 674dad0 commit 0f153cc
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions apps/files/src/components/FileEntryMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 0f153cc

Please sign in to comment.