Skip to content

Commit 81ec965

Browse files
committed
fix drop down direction fallback persist after closing the menu
1 parent 5ceedeb commit 81ec965

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

domino-ui/src/main/java/org/dominokit/domino/ui/menu/direction/DropDirection.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525

2626
/** DropDirection interface. */
2727
public interface DropDirection {
28+
29+
String DUI_POSITION_FALLBACK = "dui-position-fallback";
30+
2831
/**
2932
* init.
3033
*
@@ -53,15 +56,14 @@ default void cleanSelf(Element source) {}
5356

5457
default DropDirection fallBackPosition(DropDirectionContext context, SpaceChecker spaceChecker) {
5558
DominoElement<Element> source = elementOf(context.getSource());
56-
if (dui_menu.isAppliedTo(context.getSource())
57-
&& !source.hasAttribute("dui-position-fallback")) {
59+
if (dui_menu.isAppliedTo(context.getSource()) && !source.hasAttribute(DUI_POSITION_FALLBACK)) {
5860
source.setCssProperty(spaceChecker.getMaximumSideSpaceProperty());
5961
source.setCssProperty(spaceChecker.getMaximumVerticalSpaceProperty());
6062

6163
context.newSpaceChecker();
6264

6365
DropDirection position = position(context);
64-
source.setAttribute("dui-position-fallback", true);
66+
source.setAttribute(DUI_POSITION_FALLBACK, true);
6567
return position;
6668
}
6769
return MIDDLE_SCREEN.position(context);

domino-ui/src/main/java/org/dominokit/domino/ui/menu/direction/MiddleOfScreenDropDirection.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class MiddleOfScreenDropDirection implements DropDirection {
3131
public DropDirection position(DropDirectionContext context) {
3232
Element source = context.getSource();
3333
Element target = context.getTarget();
34+
source.removeAttribute(DUI_POSITION_FALLBACK);
3435
dui_flex_col_reverse.remove(source);
3536
DOMRect sourceRect = source.getBoundingClientRect();
3637

0 commit comments

Comments
 (0)