Skip to content

Commit

Permalink
Ensure desktop iconview root contextmenu appears in correct context (#51
Browse files Browse the repository at this point in the history
)
  • Loading branch information
andersevenrud committed Sep 12, 2019
1 parent 5ab06a4 commit 044c1a5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/adapters/ui/iconview.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,19 @@ const onDropAction = actions => (ev, data, files, shortcut = true) => {
}
};

const isRootElement = ev =>
ev.target && ev.target.classList.contains('osjs-desktop-iconview__wrapper');

const view = (fileIcon, themeIcon, droppable) => (state, actions) =>
h('div', {
class: 'osjs-desktop-iconview__wrapper',
oncontextmenu: ev => actions.openContextMenu({ev}),
oncontextmenu: ev => {
if (isRootElement(ev)) {
actions.openContextMenu({ev});
}
},
onclick: ev => {
if (ev.target && ev.target.classList.contains('osjs-desktop-iconview__wrapper')) {
if (isRootElement(ev)) {
actions.selectEntry({index: -1});
}
},
Expand Down

0 comments on commit 044c1a5

Please sign in to comment.