@@ -183,7 +183,16 @@ export default defineComponent({
183183 return this . actionsMenuStore . opened === this . uniqueId . toString ( )
184184 } ,
185185 set ( opened ) {
186- this . actionsMenuStore . opened = opened ? this . uniqueId . toString ( ) : null
186+ // If the menu is opened on another file entry, we ignore closed events
187+ if ( opened === false && this . actionsMenuStore . opened !== this . uniqueId . toString ( ) ) {
188+ return
189+ }
190+
191+ // If opened, we specify the current file id
192+ // else we set it to null to close the menu
193+ this . actionsMenuStore . opened = opened
194+ ? this . uniqueId . toString ( )
195+ : null
187196 } ,
188197 } ,
189198
@@ -248,21 +257,16 @@ export default defineComponent({
248257 } ,
249258
250259 openedMenu ( ) {
251- if ( this . openedMenu === false ) {
252- // TODO: This timeout can be removed once `close` event only triggers after the transition
253- // ref: https://github.com/nextcloud-libraries/nextcloud-vue/pull/6065
254- window . setTimeout ( ( ) => {
255- if ( this . openedMenu ) {
256- // was reopened while the animation run
257- return
258- }
259- // Reset any right menu position potentially set
260- const root = document . getElementById ( 'app-content-vue' )
261- if ( root !== null ) {
262- root . style . removeProperty ( '--mouse-pos-x' )
263- root . style . removeProperty ( '--mouse-pos-y' )
264- }
265- } , 300 )
260+ // Checking if the menu is really closed and not
261+ // just a change in the open state to another file entry.
262+ if ( this . actionsMenuStore . opened === null ) {
263+ // Reset any right menu position potentially set
264+ logger . debug ( 'All actions menu closed, resetting right menu position...' )
265+ const root = this . $el ?. closest ( 'main.app-content' ) as HTMLElement
266+ if ( root !== null ) {
267+ root . style . removeProperty ( '--mouse-pos-x' )
268+ root . style . removeProperty ( '--mouse-pos-y' )
269+ }
266270 }
267271 } ,
268272 } ,
@@ -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