diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/NotificationUnreadButton.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/NotificationUnreadButton.java index 429dc943b7..979e9ba5bf 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/NotificationUnreadButton.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/NotificationUnreadButton.java @@ -17,6 +17,7 @@ import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider; import org.springframework.beans.factory.annotation.Autowired; +import com.vaadin.event.FieldEvents.BlurEvent; import com.vaadin.navigator.View; import com.vaadin.server.FontAwesome; import com.vaadin.spring.annotation.SpringComponent; @@ -94,6 +95,11 @@ private void createNotificationWindow() { notificationsWindow.setDraggable(false); notificationsWindow.setId(UIComponentIdProvider.NOTIFICATION_UNREAD_POPUP_id); notificationsWindow.addCloseListener(event -> refreshCaption()); + notificationsWindow.addBlurListener(this::closeWindow); + } + + private void closeWindow(final BlurEvent event) { + getUI().removeWindow((Window) event.getComponent()); } private void toggleWindow(final ClickEvent event) {