Skip to content

Commit

Permalink
hide dropdown when button (or ancestor) is hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Dec 5, 2022
1 parent 9dcc761 commit caffa9a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions haxe/ui/components/DropDown.hx
Original file line number Diff line number Diff line change
Expand Up @@ -621,11 +621,13 @@ class DropDownEvents extends ButtonEvents {
public override function register() {
super.register();
registerEvent(MouseEvent.MOUSE_DOWN, onClick);
registerEvent(UIEvent.HIDDEN, onHidden);
}

public override function unregister() {
super.unregister();
unregisterEvent(MouseEvent.MOUSE_DOWN, onClick);
unregisterEvent(UIEvent.HIDDEN, onHidden);
}

private function onClick(event:MouseEvent) {
Expand All @@ -637,6 +639,10 @@ class DropDownEvents extends ButtonEvents {
}
}

private function onHidden(_) {
hideDropDown();
}

private override function onMouseClick(event:MouseEvent) {
// do nothing
}
Expand Down

0 comments on commit caffa9a

Please sign in to comment.