Skip to content

Conversation

@tejjgv
Copy link
Contributor

@tejjgv tejjgv commented Sep 19, 2025

Closes #11937

Description

Improve tab behavior to move focus even when the last item is a button

  • Limit focus changes to fields within the EntryEditor, preventing jumps to unrelated UI components.

  • Introduce static helper methods in EditorTextField to handle TAB key behavior.

  • Ensure all TextField instances in SimpleEditor, CitationKeyEditor, PersonsEditor, and MarkdownEditor have proper IDs, enabling correct detection of the last field.

Steps to test

  1. Open JabRef and load any entry in the Entry Editor.
  2. Navigate through the fields in a tab using the TAB key.
  3. When the focus reaches the last field of the current tab, press TAB again.
  4. Verify that the focus moves directly to the first field of the next tab in the Entry Editor.
  5. Repeat the process for multiple tabs to ensure that the focus does not jump to any fields outside the Entry Editor.
  6. Test both single-line and multi-line fields (e.g., SimpleEditor, PersonsEditor, MarkdownEditor) to ensure TAB navigation works consistently.

Mandatory checks

Screen.Recording.2025-09-13.155910.mp4

tejjgv and others added 23 commits September 13, 2025 01:11
# Conflicts:
#	jabgui/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
#	jabgui/src/main/java/org/jabref/gui/fieldeditors/EditorTextField.java
Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
…to fix-issue-11937

# Conflicts:
#	jabgui/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java

@Override
protected TextInputControl createTextInputControl() {
protected TextInputControl createTextInputControl(Field field) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like if you could clarify, how is this change helping?
I don't see the field parameter being used anywhere here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter isn’t used in this override, but it’s required to match the parent method’s signature. I could add a suppress annotation here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If one is having to do that, it's probably a bad use case for overriding
Will think over this

@subhramit subhramit requested a review from calixtus September 21, 2025 15:36
ClipBoardManager.addX11Support(this);
}

public void setupTabNavigation(Predicate<TextField> isLastFieldChecker, Runnable nextTabSelector) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method 'setupTabNavigation' allows null values for 'isLastFieldChecker' and 'nextTabSelector', which could lead to runtime errors. Consider using Optional to avoid null checks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use JSpecify annotations

@trag-bot
Copy link

trag-bot bot commented Sep 27, 2025

@trag-bot didn't find any issues in the code! ✅✨

@subhramit
Copy link
Member

subhramit commented Sep 27, 2025

@tejjgv please do not resolve comments yourself (unless the change is very trivial). If the person who asked for the change (or someone else who is reviewing next) has verified that your changes are correct, they will resolve the conversation themselves.

@tejjgv
Copy link
Contributor Author

tejjgv commented Sep 28, 2025

@tejjgv please do not resolve comments yourself (unless the change is very trivial). If the person who asked for the change (or someone else who is reviewing next) has verified that your changes are correct, they will resolve the conversation themselves.

Sorry, I will not resolve comments myself from now on

@tejjgv tejjgv requested a review from calixtus September 28, 2025 17:25
Copy link
Member

@calixtus calixtus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it. Does not work if you freshly open the entry editor and start navigating with tab.

@calixtus
Copy link
Member

calixtus commented Oct 6, 2025

Seems like it does not work with book and from optional fields tab

@jabref-machine
Copy link
Collaborator

Your code currently does not meet JabRef's code guidelines. IntelliJ auto format covers some cases. There seem to be issues with your code style and autoformat configuration. Please reformat your code (Ctrl+Alt+L) and commit, then push.

In special cases, consider using // formatter:off and // formatter:on annotations to allow deviation from the code style.

@tejjgv
Copy link
Contributor Author

tejjgv commented Oct 11, 2025

Seems like it does not work with book and from optional fields tab

I will look into this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tab in the last text field in a tab should focus the next tab in the tabs of the entry editor.

5 participants