Skip to content

Commit

Permalink
fix: prevent selected item checkmark icon from flashing (#6635)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan authored Oct 12, 2023
1 parent e32a9c5 commit 986a777
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/context-menu/src/vaadin-contextmenu-items-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,12 @@ export const ItemsMixin = (superClass) =>
const { value } = event.detail;
if (typeof value === 'number') {
const item = listBox.items[value]._item;
// Reset selected before dispatching the event to prevent
// checkmark icon flashing before the overlay is closed.
listBox.selected = null;
if (!item.children) {
this.dispatchEvent(new CustomEvent('item-selected', { detail: { value: item } }));
}
listBox.selected = null;
}
});

Expand Down

0 comments on commit 986a777

Please sign in to comment.