diff --git a/src/main/java/org/jabref/gui/search/GlobalSearchBar.java b/src/main/java/org/jabref/gui/search/GlobalSearchBar.java index 9cc91baeee27..05341a52c4eb 100644 --- a/src/main/java/org/jabref/gui/search/GlobalSearchBar.java +++ b/src/main/java/org/jabref/gui/search/GlobalSearchBar.java @@ -126,13 +126,14 @@ public GlobalSearchBar(JabRefFrame frame, StateManager stateManager, Preferences // searchModeButton = new Button(); initSearchModifierButtons(); - BooleanBinding focusBinding = searchField.focusedProperty() - .or(regularExpressionButton.focusedProperty() - .or(caseSensitiveButton.focusedProperty())); + BooleanBinding focusedOrActive = searchField.focusedProperty() + .or(searchField.textProperty() + .isNotEmpty()); + regularExpressionButton.visibleProperty().unbind(); - regularExpressionButton.visibleProperty().bind(focusBinding); + regularExpressionButton.visibleProperty().bind(focusedOrActive); caseSensitiveButton.visibleProperty().unbind(); - caseSensitiveButton.visibleProperty().bind(focusBinding); + caseSensitiveButton.visibleProperty().bind(focusedOrActive); StackPane modifierButtons = new StackPane(new HBox(regularExpressionButton, caseSensitiveButton)); modifierButtons.setAlignment(Pos.CENTER);