Skip to content

Commit

Permalink
Fix: context menu placed inaccessibly when triggered via keyboard nav…
Browse files Browse the repository at this point in the history
…igation (#7230)

Calc dropdown position by trigger button instead of pointer event
  • Loading branch information
Jan authored Jul 7, 2022
1 parent 9f944c7 commit 6d99367
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Context menu misplaced when triggered by keyboard navigation

We've fixed a bug where triggering the context menu by keyboard navigation misplaced the menu and made it inaccessible.

https://github.com/owncloud/web/pull/7230
https://github.com/owncloud/web/issues/7187
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
<slot name="quickActions" :resource="item" />
<oc-button
:id="`context-menu-trigger-${resourceDomSelector(item)}`"
ref="contextMenuButton"
v-oc-tooltip="contextMenuLabel"
:aria-label="contextMenuLabel"
class="resource-table-btn-action-dropdown"
Expand Down Expand Up @@ -648,16 +649,19 @@ export default defineComponent({
this.displayPositionedDropdown(instance._tippy, event)
},
displayPositionedDropdown(dropdown, event) {
const contextMenuButtonPos = this.$refs.contextMenuButton.$el.getBoundingClientRect()
dropdown.setProps({
getReferenceClientRect: () => ({
width: 0,
height: 0,
top: event.clientY,
bottom: event.clientY,
left: event.clientX,
right: event.clientX
top: event.pointerType === 'mouse' ? event.clientY : contextMenuButtonPos.top,
bottom: event.pointerType === 'mouse' ? event.clientY : contextMenuButtonPos.bottom,
left: event.pointerType === 'mouse' ? event.clientX : contextMenuButtonPos.x,
right: event.pointerType === 'mouse' ? event.clientX : contextMenuButtonPos.x
})
})
dropdown.show()
},
rowMounted(resource, component) {
Expand Down

0 comments on commit 6d99367

Please sign in to comment.