@@ -176,7 +176,16 @@ export default defineComponent({
176176 return this . actionsMenuStore . opened === this . uniqueId . toString ( )
177177 } ,
178178 set ( opened ) {
179- this . actionsMenuStore . opened = opened ? this . uniqueId . toString ( ) : null
179+ // If the menu is opened on another file entry, we ignore closed events
180+ if ( opened === false && this . actionsMenuStore . opened !== this . uniqueId . toString ( ) ) {
181+ return
182+ }
183+
184+ // If opened, we specify the current file id
185+ // else we set it to null to close the menu
186+ this . actionsMenuStore . opened = opened
187+ ? this . uniqueId . toString ( )
188+ : null
180189 } ,
181190 } ,
182191
@@ -243,21 +252,16 @@ export default defineComponent({
243252 } ,
244253
245254 openedMenu ( ) {
246- if ( this . openedMenu === false ) {
247- // TODO: This timeout can be removed once `close` event only triggers after the transition
248- // ref: https://github.com/nextcloud-libraries/nextcloud-vue/pull/6065
249- window . setTimeout ( ( ) => {
250- if ( this . openedMenu ) {
251- // was reopened while the animation run
252- return
253- }
254- // Reset any right menu position potentially set
255- const root = document . getElementById ( 'app-content-vue' )
256- if ( root !== null ) {
257- root . style . removeProperty ( '--mouse-pos-x' )
258- root . style . removeProperty ( '--mouse-pos-y' )
259- }
260- } , 300 )
255+ // Checking if the menu is really closed and not
256+ // just a change in the open state to another file entry.
257+ if ( this . actionsMenuStore . opened === null ) {
258+ // Reset any right menu position potentially set
259+ logger . debug ( 'All actions menu closed, resetting right menu position...' )
260+ const root = this . $el ?. closest ( 'main.app-content' ) as HTMLElement
261+ if ( root !== null ) {
262+ root . style . removeProperty ( '--mouse-pos-x' )
263+ root . style . removeProperty ( '--mouse-pos-y' )
264+ }
261265 }
262266 } ,
263267 } ,
@@ -298,6 +302,7 @@ export default defineComponent({
298302 const contentRect = root . getBoundingClientRect ( )
299303 // Using Math.min/max to prevent the menu from going out of the AppContent
300304 // 200 = max width of the menu
305+ logger . debug ( 'Setting actions menu position...' )
301306 root . style . setProperty ( '--mouse-pos-x' , Math . max ( 0 , event . clientX - contentRect . left - 200 ) + 'px' )
302307 root . style . setProperty ( '--mouse-pos-y' , Math . max ( 0 , event . clientY - contentRect . top ) + 'px' )
303308 } else {
0 commit comments