diff --git a/CHANGELOG.md b/CHANGELOG.md index 268821c7a7a..4d66125d527 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -124,6 +124,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We fixed an issue where trying to open a library from a failed mounted directory on Mac would cause an error. [#10548](https://github.com/JabRef/jabref/issues/10548) - We fixed an issue when the preview was out of sync. [#9172](https://github.com/JabRef/jabref/issues/9172) - We fixed an issue where identifier paste couldn't work with Unicode REPLACEMENT CHARACTER. [#11986](https://github.com/JabRef/jabref/issues/11986) +- We fixed an issue when click on entry at "Check Integrity" wasn't properly focusing the entry and field. [#11997](https://github.com/JabRef/jabref/issues/11997) ### Removed diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java index 3a2bd6f2258..ab1bb640dfe 100644 --- a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java +++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java @@ -13,6 +13,7 @@ import java.util.SortedSet; import java.util.stream.Collectors; +import javafx.application.Platform; import javafx.fxml.FXML; import javafx.geometry.Side; import javafx.scene.control.Button; @@ -61,6 +62,7 @@ import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.BibEntryTypesManager; +import org.jabref.model.entry.EntryConverter; import org.jabref.model.entry.field.Field; import org.jabref.model.util.DirectoryMonitorManager; import org.jabref.model.util.FileUpdateMonitor; @@ -463,11 +465,26 @@ private void fetchAndMerge(EntryBasedFetcher fetcher) { public void setFocusToField(Field field) { UiTaskExecutor.runInJavaFXThread(() -> { + Field actualField = field; + boolean fieldFound = false; for (Tab tab : tabbed.getTabs()) { + tabbed.getSelectionModel().select(tab); if ((tab instanceof FieldsEditorTab fieldsEditorTab) - && fieldsEditorTab.getShownFields().contains(field)) { + && fieldsEditorTab.getShownFields().contains(actualField)) { tabbed.getSelectionModel().select(tab); - fieldsEditorTab.requestFocus(field); + Platform.runLater(() -> { + fieldsEditorTab.requestFocus(actualField); + }); + // This line explicitly brings focus back to the main window containing the Entry Editor. + getScene().getWindow().requestFocus(); + fieldFound = true; + break; + } + } + if (!fieldFound) { + Field aliasField = EntryConverter.FIELD_ALIASES.get(field); + if (aliasField != null) { + setFocusToField(aliasField); } } });