Skip to content

Commit

Permalink
Fix issue JabRef#11938: Tab in empty text area field should focus the…
Browse files Browse the repository at this point in the history
… next field
  • Loading branch information
yeonissa committed Oct 22, 2024
1 parent df8d955 commit d194344
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/org/jabref/gui/fieldeditors/EditorTextArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,23 @@ public class EditorTextArea extends TextArea implements Initializable, ContextMe
};

public EditorTextArea() {
// Call the constructor with an empty string
this("");

// Add an event filter to handle key press events
this.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
// If the TAB key is pressed and the TextArea is empty
if (event.getCode() == KeyCode.TAB && this.getText().isEmpty()) {
// Move the focus to the next parent element (likely the next form field)
this.getParent().requestFocus();

// Consume the event to prevent further processing of the TAB key
event.consume();
}
});
}


public EditorTextArea(final String text) {
super(text);

Expand Down

0 comments on commit d194344

Please sign in to comment.