Skip to content

Commit f589c16

Browse files
VishakhaMathurCallum-Higginsonu7663368subhramitSiedlerchr
authored
ESC closes the preferences dialog when editing table. (#14106)
* Change preferences dialog behaviour so esc key press is not consumed by cell-based controls (ListView/TableView/TreeView/TreeTableView) * WIP: local changes before rebase * Changes in the fix * added changes in the code * Fix submodules * add changelog --------- Co-authored-by: Callum Higginson <[email protected]> Co-authored-by: Vishakha <[email protected]> Co-authored-by: Subhramit Basu <[email protected]> Co-authored-by: Christoph <[email protected]>
1 parent 2538565 commit f589c16

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
1515

1616
### Fixed
1717

18+
- We fixed an issue where pressing <kbd>ESC</kbd> in the preferences dialog would not always close the dialog. [#8888](https://github.com/JabRef/jabref/issues/8888)
19+
1820
### Removed
1921

2022
## [6.0-alpha.3] – 2025-10-30

jabgui/src/main/java/org/jabref/gui/preferences/PreferencesDialogView.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@
77
import javafx.scene.control.ButtonType;
88
import javafx.scene.control.ListView;
99
import javafx.scene.control.ScrollPane;
10+
import javafx.scene.control.TableView;
1011
import javafx.scene.control.ToggleButton;
12+
import javafx.scene.control.TreeTableView;
13+
import javafx.scene.control.TreeView;
1114
import javafx.scene.input.KeyCode;
15+
import javafx.scene.input.KeyEvent;
1216

1317
import org.jabref.gui.DialogService;
1418
import org.jabref.gui.icon.IconTheme;
@@ -93,6 +97,14 @@ private void initialize() {
9397
preferencesContainer.setContent(preferencesTab.getBuilder());
9498
preferencesTab.prefWidthProperty().bind(preferencesContainer.widthProperty().subtract(10d));
9599
preferencesTab.getStyleClass().add("preferencesTab");
100+
this.getDialogPane().addEventFilter(KeyEvent.KEY_PRESSED, event -> {
101+
if (preferences.getKeyBindingRepository().checkKeyCombinationEquality(KeyBinding.CLOSE, event)) {
102+
if (event.getTarget() instanceof ListView || event.getTarget() instanceof TableView || event.getTarget() instanceof TreeView || event.getTarget() instanceof TreeTableView) {
103+
this.closeDialog();
104+
event.consume();
105+
}
106+
}
107+
});
96108
} else {
97109
preferencesContainer.setContent(null);
98110
}

0 commit comments

Comments
 (0)