Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: context menu placed inaccessibly when triggered via keyboard navigation #7230

Merged
merged 5 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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