Skip to content
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
6 changes: 3 additions & 3 deletions addon/components/o-s-s/context-menu/panel.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
@selected={{item.selected}}
@disabled={{item.disabled}}
@onSelect={{item.action}}
{{on "mouseenter" (fn this.openSubMenu item.items index)}}
{{did-insert registerMouseEnterOnParent (fn this.openSubMenu item.items index)}}
{{on "click" (fn this.toggleSubMenu item.items index)}}
class="infinit-select-option-panel-container {{if (eq index this.subReferenceIndex) 'active' ''}}"
/>
{{else if item.rowRenderer}}
<item.rowRenderer
@item={{item}}
{{on "mouseenter" this.closeSubMenu}}
{{did-insert registerMouseEnterOnParent this.closeSubMenu}}
{{on "click" (fn this.callAction item.action)}}
/>
{{else}}
Expand All @@ -61,7 +61,7 @@
@selected={{item.selected}}
@disabled={{item.disabled}}
@onSelect={{fn this.callAction item.action}}
{{on "mouseenter" this.closeSubMenu}}
{{did-insert registerMouseEnterOnParent this.closeSubMenu}}
class="infinit-select-option-panel-container"
/>
{{/if}}
Expand Down
9 changes: 9 additions & 0 deletions addon/components/o-s-s/context-menu/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ export default class OSSContextMenuPanelComponent extends Component<OSSContextMe
}
}

@action
registerMouseEnterOnParent(element: HTMLElement, templateArgs: Array<(event: PointerEvent) => void>): void {
const callback = templateArgs[0];
if (callback) {
const targetElement = element.parentElement?.matches('li[role="button"]') ? element.parentElement : element;
targetElement.addEventListener('pointerenter', callback);
}
}

private clearSubMenu(): void {
this.displaySubMenu = false;
this.subReferenceIndex = -1;
Expand Down
Loading