Skip to content

Fix citations fetcher name overlaps with citation key #15047#15076

Merged
Siedlerchr merged 11 commits into
JabRef:mainfrom
Gabriele-DM-unimol:fix/citation-relations-ui-overlap
Feb 10, 2026
Merged

Fix citations fetcher name overlaps with citation key #15047#15076
Siedlerchr merged 11 commits into
JabRef:mainfrom
Gabriele-DM-unimol:fix/citation-relations-ui-overlap

Conversation

@Gabriele-DM-unimol

@Gabriele-DM-unimol Gabriele-DM-unimol commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

Closes 15047

This PR fixes the UI overlap issue in the Citation Relations tab by implementing responsive label widths and text ellipsis. I adjusted the AnchorPane constraints and added HGrow priorities to ensure that action buttons and the fetcher ComboBox remain accessible and visible even with very long entry titles.

Library with a single entry with me as author and as title the issue number
Identity

Before
before

After
after 1

After
image

Steps to test

  1. Open JabRef and select or create an entry with an exceptionally long title (e.g., more than 150 characters).

  2. Go to the Citations tab in the entry editor.

  3. Observe the column labels ("References cited in..." and "References that cite...").

  4. Expected Result: The labels should no longer overlap with the action buttons or the fetcher dropdown. Instead, they should truncate gracefully with an ellipsis (...) when space is limited, as shown in the verification screenshots below.

  • I own the copyright of the code submitted and I license it under the MIT license
  • I manually tested my changes in running JabRef (always required)
  • [/] I added JUnit tests for changes (if applicable)
  • I added screenshots in the PR description (if change is visible to the user)
  • I added a screenshot in the PR description showing a library with a single entry with me as author and as title the issue number.
  • I described the change in CHANGELOG.md in a way that is understandable for the average user (if change is visible to the user)
  • I checked the user documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request updating file(s) in https://github.com/JabRef/user-documentation/tree/main/en.

@github-actions

Copy link
Copy Markdown
Contributor

Hey @Gabriele-DM-unimol! 👋

Thank you for contributing to JabRef!

We have automated checks in place, based on which you will soon get feedback if any of them are failing. We also use Qodo for review assistance. It will update your pull request description with a review help and offer suggestions to improve the pull request.

After all automated checks pass, a maintainer will also review your contribution. Once that happens, you can go through their comments in the "Files changed" tab and act on them, or reply to the conversation if you have further inputs. You can read about the whole pull request process in our contribution guide.

Please ensure that your pull request is in line with our AI Usage Policy and make necessary disclosures.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Fix Citation Relations tab UI overlap with responsive labels

🐞 Bug fix ✨ Enhancement

Grey Divider

Walkthroughs

Description
• Fix UI label overlap in Citation Relations tab with responsive widths
• Add text ellipsis for long entry titles to prevent component overlap
• Implement HGrow priority for labels to adapt to available space
• Adjust AnchorPane right anchor constraints for proper layout
Diagram
flowchart LR
  A["Long Entry Title"] -->|triggers overlap| B["Citation Labels"]
  B -->|before fix| C["Labels overlap buttons"]
  B -->|after fix| D["Responsive widths + Ellipsis"]
  D --> E["Proper layout with HGrow"]
Loading

Grey Divider

File Changes

1. jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java 🐞 Bug fix +10/-4

Add responsive label sizing and text ellipsis

• Modified styleLabel() method to accept rightanchor parameter for flexible AnchorPane
 constraints
• Added text ellipsis (OverrunStyle.ELLIPSIS) to both citation labels
• Set minimum width (100px) for labels to maintain readability
• Applied HBox.setHgrow() with Priority.ALWAYS for responsive label expansion
• Updated right anchor values: 250.00 for citing label, 80.00 for cited-by label

jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java


2. CHANGELOG.md 📝 Documentation +2/-1

Document Citation Relations UI overlap fix

• Added entry documenting the fix for Citation Relations tab UI overlap issue #15047
• Placed in the bug fixes section with proper issue reference link

CHANGELOG.md


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (2) 📎 Requirement gaps (0)

Grey Divider


Action required

✅ 1. Empty CHANGELOG bullet 📘 Rule violation ✓ Correctness
Description
CHANGELOG.md contains an empty list item (- ), which is malformed and can break markdown
  rendering or release note generation.
• This introduces user-facing documentation noise and makes the changelog harder to read and parse.
Code

CHANGELOG.md[R67-68]

+- Fixed UI overlap in Citation Relations tab when entry titles are very long. [#15047](https://github.com/JabRef/jabref/issues/15047)
+- 
Evidence
Compliance requires that changelog/documentation text changes do not introduce malformed or
erroneous content. The added changelog section includes an empty bullet line.

CHANGELOG.md[67-68]
Best Practice: Learned patterns

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`CHANGELOG.md` has an empty bullet point (`- `) which is malformed markdown and should not be present in release notes.
## Issue Context
This was introduced near the new entry for #15047.
## Fix Focus Areas
- CHANGELOG.md[67-68]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

✅ 2. rightanchor naming inconsistent 📘 Rule violation ✓ Correctness
Description
• The new styleLabel(..., double rightanchor) parameter name does not follow standard Java
  camelCase conventions, reducing readability and consistency with the rest of the codebase.
• Using inconsistent identifier casing makes the code harder to maintain and search for, especially
  in UI layout-related helpers.
Code

jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java[R619-626]

+    private void styleLabel(Label label, String tooltipText, double rightanchor) {
       label.setStyle("-fx-padding: 5px");
       label.setAlignment(Pos.CENTER);
       label.setTooltip(new Tooltip(tooltipText));
       AnchorPane.setTopAnchor(label, 0.0);
       AnchorPane.setLeftAnchor(label, 0.0);
       AnchorPane.setBottomAnchor(label, 0.0);
-        AnchorPane.setRightAnchor(label, 0.0);
+        AnchorPane.setRightAnchor(label, rightanchor);
Evidence
The checklist requires new identifiers to match existing naming conventions and be
intention-revealing. The introduced parameter rightanchor is inconsistent with typical camelCase
and the JavaFX API naming style (setRightAnchor).

AGENTS.md
jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java[619-626]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The parameter name `rightanchor` does not follow Java camelCase conventions and is inconsistent with surrounding code style.
## Issue Context
This is a newly introduced parameter in `styleLabel` and should be renamed consistently to improve readability.
## Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java[366-375]
- jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java[619-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


✅ 3. Brittle header spacing 🐞 Bug ⛯ Reliability
Description
• The new layout fix reserves space for right-side controls by hard-coding
  AnchorPane.setRightAnchor(label, 250/80) for the header labels.
• This is brittle: the reserved width is based on fixed pixel assumptions about control
  widths/CSS/DPI, and it doesn’t adapt if button sizes/padding/theme/font scaling change, risking
  renewed overlap or overly truncated headings.
• HBox.setHgrow(...) is also applied to labels that are placed in an AnchorPane, so it has no
  effect and may give a false sense that the layout is responsive.
Code

jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java[R367-375]

+        styleLabel(citingLabel, Localization.lang("Also called \"backward citations\""), 250.00);
+        citingLabel.setMinWidth(100);
+        citingLabel.setTextOverrun(javafx.scene.control.OverrunStyle.ELLIPSIS);
+        HBox.setHgrow(citingLabel, javafx.scene.layout.Priority.ALWAYS);
       Label citedByLabel = new Label(Localization.lang("References that cite %0", citationKey));
-        styleLabel(citedByLabel, Localization.lang("Also called \"forward citations\""));
+        styleLabel(citedByLabel, Localization.lang("Also called \"forward citations\""), 80.00);
+        citedByLabel.setMinWidth(100);
+        citedByLabel.setTextOverrun(javafx.scene.control.OverrunStyle.ELLIPSIS);
+        HBox.setHgrow(citedByLabel, javafx.scene.layout.Priority.ALWAYS);
Evidence
The header bars are AnchorPanes with multiple controls anchored to the right at fixed offsets.
After search completes, both refresh and import are visible at the same time, so the label must
reliably avoid both. The PR accomplishes this by hard-coding a right anchor on the label (250/80),
which is tightly coupled to current control sizing (offsets and pref widths) and can regress with
styling/scale changes. Also, HBox grow constraints won’t apply inside AnchorPane.

jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java[357-375]
jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java[386-433]
jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java[791-825]
jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java[615-627]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Citation Relations tab header uses an `AnchorPane` and hard-coded right-anchor values (250px/80px) to keep the heading label from overlapping right-aligned controls. This is brittle across DPI/font scaling/CSS changes and can reintroduce overlap or cause excessive truncation.
### Issue Context
- The header area (`citingHBox`/`citedByHBox`) is an `AnchorPane` containing the label plus several right-anchored controls.
- In the steady state after a successful fetch, both refresh + import are visible simultaneously.
- The current fix reserves space via hard-coded pixel anchors on the label.
### Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java[349-437]
- jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java[615-637]
### Suggested change
Refactor the top bar to a responsive layout:
1. Replace each `AnchorPane` top bar with a `BorderPane` or `HBox`:
 - Left/center: the heading `Label` with `setMaxWidth(Double.MAX_VALUE)` and `setTextOverrun(ELLIPSIS)`.
 - Right: an `HBox` containing the controls (fetcher combo + buttons) with spacing/padding.
2. Remove the hard-coded right-anchor parameter from `styleLabel` (or stop using AnchorPane constraints for labels).
3. Ensure the label has `HBox.setHgrow(label, Priority.ALWAYS)` only when it is actually inside an `HBox`.
This keeps the label from overlapping controls without relying on magic pixel constants.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment thread CHANGELOG.md Outdated
@github-actions github-actions Bot added the status: changes-required Pull requests that are not yet complete label Feb 10, 2026
@jabref-machine

Copy link
Copy Markdown
Collaborator

You have removed the "Mandatory Checks" section from your pull request description. Please adhere to our pull request template.

@jabref-machine

Copy link
Copy Markdown
Collaborator

Note that your PR will not be reviewed/accepted until you have gone through the mandatory checks in the description and marked each of them them exactly in the format of [x] (done), [ ] (not done yet) or [/] (not applicable). Please adhere to our pull request template.

@testlens-app

testlens-app Bot commented Feb 10, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: de4e0a3
▶️ Tests: 11187 executed
⚪️ Checks: 48/48 completed


Learn more about TestLens at testlens.app.

@Gabriele-DM-unimol

Gabriele-DM-unimol commented Feb 10, 2026

Copy link
Copy Markdown
Contributor Author

I've refactored the layout to use HBox instead of AnchorPane and removed the hard-coded anchors as suggested by Qodo. This makes the UI responsive and handles text truncation correctly. @Siedlerchr What do you think? Thanks in advance.

@Gabriele-DM-unimol

Copy link
Copy Markdown
Contributor Author

Hi. What can I do now?

TaskExecutor taskExecutor,
BibEntryTypesManager bibEntryTypesManager,
SearchCitationsRelationsService searchCitationsRelationsService) {
public CitationRelationsTab(DialogService dialogService, UndoManager undoManager, StateManager stateManager, FileUpdateMonitor fileUpdateMonitor, GuiPreferences preferences, TaskExecutor taskExecutor, BibEntryTypesManager bibEntryTypesManager, SearchCitationsRelationsService searchCitationsRelationsService) {

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.

Please revert this formatting change here; it makes it harder to read

fileUpdateMonitor,
taskExecutor
);
this.citationsRelationsTabViewModel = new CitationsRelationsTabViewModel(preferences, undoManager, stateManager, dialogService, fileUpdateMonitor, taskExecutor);

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.

same as above, formatting changes makes it harde to see the real diff

"JabRef was unable to open a web browser for link:\n\n" + URLs.SCITE_URL + "\n\nError Message:\n\n" + ioex.getMessage(),
ioex
);
dialogService.showErrorDialogAndWait("An error occurred opening web browser", "JabRef was unable to open a web browser for link:\n\n" + URLs.SCITE_URL + "\n\nError Message:\n\n" + ioex.getMessage(), ioex);

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.

same here and the other

CitationFetcher.SearchType.CITED_BY,
importCitedByButton,
citedByProgress);
CitationComponents citingComponents = new CitationComponents(entry, citingListView, abortCitingButton, refreshCitingButton, CitationFetcher.SearchType.CITES, importCitingButton, citingProgress);

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.

please revert all these formatting changes.

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.

I apologize, I'll try to fix it right away

@Siedlerchr

Copy link
Copy Markdown
Member

@Gabriele-DM-unimol Wait for a review of one of the maintainers. Please be aware that we all develop JabRef in our free time despite having full time jobs. So it sometimes may take a while

The UI Change is okay for me, but just revert the formatting changes

@Siedlerchr Siedlerchr enabled auto-merge February 10, 2026 21:15
@Siedlerchr

Copy link
Copy Markdown
Member

if you want to take another issue with UI fixes, I suggest taking a look at #11589

@Siedlerchr Siedlerchr added this pull request to the merge queue Feb 10, 2026
@github-actions github-actions Bot added the status: to-be-merged PRs which are accepted and should go into the merge-queue. label Feb 10, 2026
Merged via the queue into JabRef:main with commit 8dc03c2 Feb 10, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first contrib status: changes-required Pull requests that are not yet complete status: to-be-merged PRs which are accepted and should go into the merge-queue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Citations tab: Citations fetcher name overlaps with citation key

4 participants