Skip to content

Commit

Permalink
fix 988 Selected Item in a Row Context Menu Stays Selected Once Opene…
Browse files Browse the repository at this point in the history
…d Again
  • Loading branch information
vegegoku committed Dec 19, 2024
1 parent f28c0fe commit d1118d1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions domino-ui/src/main/java/org/dominokit/domino/ui/menu/Menu.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,18 @@ public class Menu<V> extends BaseDominoElement<HTMLDivElement, Menu<V>>
evt -> {
evt.stopPropagation();
evt.preventDefault();
lastTarget =

MenuTarget newTarget =
targets.get(elementOf(Js.<HTMLElement>uncheckedCast(evt.currentTarget)).getDominoId());
if (isNull(lastTarget)) {
lastTarget =
if (isNull(newTarget)) {
newTarget =
targets.get(elementOf(Js.<HTMLElement>uncheckedCast(evt.target)).getDominoId());
}
if (!Objects.equals(newTarget, lastTarget)) {
getSelection().forEach(item -> item.deselect(true));
}

lastTarget = newTarget;
if (isAutoOpen()) {
if (isOpened() && !isContextMenu()) {
close();
Expand Down

0 comments on commit d1118d1

Please sign in to comment.