Skip to content

Refine tab to move focus even when the last item is a button#13938

Merged
koppor merged 47 commits into
JabRef:mainfrom
tejjgv:fix-issue-11937
Dec 4, 2025
Merged

Refine tab to move focus even when the last item is a button#13938
koppor merged 47 commits into
JabRef:mainfrom
tejjgv:fix-issue-11937

Conversation

@tejjgv

@tejjgv tejjgv commented Sep 19, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

@Siedlerchr Siedlerchr removed the status: changes-required Pull requests that are not yet complete label Dec 2, 2025
@Siedlerchr

Copy link
Copy Markdown
Member

Tab nav works also now when with the ctie key button

@Siedlerchr Siedlerchr requested a review from koppor December 2, 2025 20:52
@github-actions github-actions Bot added status: changes-required Pull requests that are not yet complete and removed status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers status: changes-required Pull requests that are not yet complete labels Dec 2, 2025
@koppor

koppor commented Dec 3, 2025

Copy link
Copy Markdown
Member

I am on the generate button. I pressing Tab, the tab "Optional fields" should be focussed

grafik

Nothing visible is selected however. When pressing Tab again, the search bar is selected.

@koppor koppor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Small comments

Did not work for me on Windows 11

Maybe, we need LOGGER.trace statements and add enable trace for EntryEditor.java in tinylog.properties?

Comment thread jabgui/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java Outdated
Comment thread jabgui/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java Outdated
Comment thread jabgui/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java Outdated
ClipBoardManager.addX11Support(this);
}

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Still a TODO

@github-actions github-actions Bot added the status: changes-required Pull requests that are not yet complete label Dec 3, 2025
Siedlerchr and others added 3 commits December 3, 2025 19:45
Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
@github-actions github-actions Bot removed the status: changes-required Pull requests that are not yet complete label Dec 3, 2025
@Siedlerchr

Copy link
Copy Markdown
Member

@koppor Select the first field in required fields and then just hit tab

jabrefjkeyboard.mov

@koppor

koppor commented Dec 4, 2025

Copy link
Copy Markdown
Member
  • Do we need a second issue for Shift+Tab or could this be done in this PR? 😅

@koppor

koppor commented Dec 4, 2025

Copy link
Copy Markdown
Member

Does not work on Windows 10:

https://www.loom.com/share/7c0d4090a9d24952a8e96bd937e299f7

I tried commit e32c12d

@koppor

koppor commented Dec 4, 2025

Copy link
Copy Markdown
Member

I tried again with

gg.cmd just run-pr 13938

and it worked fine. 😅

@koppor koppor dismissed calixtus’s stale review December 4, 2025 13:39

Everything addressed

@koppor koppor added this pull request to the merge queue Dec 4, 2025
Merged via the queue into JabRef:main with commit 10762da Dec 4, 2025
52 checks passed
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