Skip to content

Commit

Permalink
Refactor #3021
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Oct 19, 2022
1 parent 608362b commit 5ac875e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/contextmenu/ContextMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ export default {
this.visible ? this.hide(event) : this.show(event);
},
show(event) {
this.activeItemPath = [];
this.focusedItemInfo = { index: -1, level: 0, parentKey: '' };
DomHandler.focus(this.list);
this.pageX = event.pageX;
this.pageY = event.pageY;
this.visible ? this.position() : (this.visible = true);
Expand All @@ -165,7 +169,7 @@ export default {
},
onFocus(event) {
this.focused = true;
this.focusedItemInfo = { index: -1, level: 0, parentKey: '' };
this.focusedItemInfo = this.focusedItemInfo.index !== -1 ? this.focusedItemInfo : { index: -1, level: 0, parentKey: '' };
this.$emit('focus', event);
},
onBlur(event) {
Expand Down Expand Up @@ -266,7 +270,7 @@ export default {
this.focusedItemInfo = { index, level, parentKey };
!root && (this.dirty = true);
DomHandler.focus(this.menubar);
DomHandler.focus(this.list);
} else {
grouped ? this.onItemChange(event) : this.hide(originalEvent, !root);
}
Expand Down Expand Up @@ -377,12 +381,12 @@ export default {
}
},
onAfterEnter() {
this.list.focus();
this.bindOutsideClickListener();
this.bindResizeListener();
this.bindDocumentContextMenuListener();
this.$emit('show');
DomHandler.focus(this.list);
},
onLeave() {
this.unbindOutsideClickListener();
Expand Down

0 comments on commit 5ac875e

Please sign in to comment.