Skip to content

Commit 463a68f

Browse files
authored
Merge pull request #44139 from nextcloud/fix/right-click-files-list
fix(files): Right click menu offset and list scrolled glitch
2 parents 5723c13 + 84ceadd commit 463a68f

File tree

8 files changed

+15
-13
lines changed

8 files changed

+15
-13
lines changed

apps/files/src/components/FileEntry/FileEntryActions.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,13 @@ export default Vue.extend({
352352
<style lang="scss">
353353
// Allow right click to define the position of the menu
354354
// only if defined
355-
[style*="mouse-pos-x"] .v-popper__popper {
355+
main.app-content[style*="mouse-pos-x"] .v-popper__popper {
356356
transform: translate3d(var(--mouse-pos-x), var(--mouse-pos-y), 0px) !important;
357357
358358
// If the menu is too close to the bottom, we move it up
359359
&[data-popper-placement="top"] {
360-
transform: translate3d(var(--mouse-pos-x), calc(var(--mouse-pos-y) - 50vh), 0px) !important;
360+
// 34px added to align with the top of the cursor
361+
transform: translate3d(var(--mouse-pos-x), calc(var(--mouse-pos-y) - 50vh + 34px), 0px) !important;
361362
}
362363
// Hide arrow if floating
363364
.v-popper__arrow-container {

apps/files/src/components/FileEntryMixin.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export default defineComponent({
162162
if (opened) {
163163
// Reset any right click position override on close
164164
// Wait for css animation to be done
165-
const root = this.$root.$el as HTMLElement
165+
const root = this.$el?.closest('main.app-content') as HTMLElement
166166
root.style.removeProperty('--mouse-pos-x')
167167
root.style.removeProperty('--mouse-pos-y')
168168
}
@@ -210,12 +210,13 @@ export default defineComponent({
210210
// The grid mode is compact enough to not care about
211211
// the actions menu mouse position
212212
if (!this.gridMode) {
213-
const root = this.$root.$el as HTMLElement
213+
// Actions menu is contained within the app content
214+
const root = this.$el?.closest('main.app-content') as HTMLElement
214215
const contentRect = root.getBoundingClientRect()
215216
// Using Math.min/max to prevent the menu from going out of the AppContent
216217
// 200 = max width of the menu
217-
root.style.setProperty('--mouse-pos-x', Math.max(contentRect.left, Math.min(event.clientX, event.clientX - 200)) + 'px')
218-
root.style.setProperty('--mouse-pos-y', Math.max(contentRect.top, event.clientY - contentRect.top) + 'px')
218+
root.style.setProperty('--mouse-pos-x', Math.max(0, event.clientX - contentRect.left - 200) + 'px')
219+
root.style.setProperty('--mouse-pos-y', Math.max(0, event.clientY - contentRect.top) + 'px')
219220
}
220221

221222
// If the clicked row is in the selection, open global menu

apps/files/src/components/FilesListVirtual.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ export default defineComponent({
326326
--clickable-area: 44px;
327327
--icon-preview-size: 32px;
328328
329-
position: relative;
330329
overflow: auto;
331330
height: 100%;
332331
will-change: scroll-position;

cypress/support/e2e.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ import './commands.ts'
2525
// Fix ResizeObserver loop limit exceeded happening in Cypress only
2626
// @see https://github.com/cypress-io/cypress/issues/20341
2727
Cypress.on('uncaught:exception', err => !err.message.includes('ResizeObserver loop limit exceeded'))
28+
Cypress.on('uncaught:exception', err => !err.message.includes('ResizeObserver loop completed with undelivered notifications'))

dist/core-common.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-common.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)