Skip to content

Fix side pane width not remembered after restart (#8907)#15390

Merged
calixtus merged 2 commits into
JabRef:mainfrom
AnvitaPrasad:fix/sidepane-width-not-remembered-8907
Mar 24, 2026
Merged

Fix side pane width not remembered after restart (#8907)#15390
calixtus merged 2 commits into
JabRef:mainfrom
AnvitaPrasad:fix/sidepane-width-not-remembered-8907

Conversation

@AnvitaPrasad

@AnvitaPrasad AnvitaPrasad commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Related issues and pull requests

Closes #8907

PR Description

Fixed the side pane (Groups/Web search) width not being restored after restarting JabRef. The horizontal divider position was being saved as a normalized 0-1 value from JavaFX's Divider.positionProperty, but on restore it was incorrectly divided by the split pane's pixel width, causing it to collapse to near-zero on every startup. Removed the erroneous division so the horizontal divider is now restored the same way the vertical divider already is - using the normalized position directly.

Before

Screen.Recording.2026-03-23.at.2.10.56.PM.mov

After

Screen.Recording.2026-03-23.at.2.14.00.PM.mov

On restarting Jabref:

Screen.Recording.2026-03-23.at.3.03.59.PM.mov

Steps to test

  1. Open JabRef and ensure the Groups or Web Search side pane is visible (toggle via the View menu if needed).
  2. Drag the divider between the side pane and the main entry table to resize it . make it noticeably wider or narrower than the default (Or click the up/down arrows as shown in the screenshot).
  3. Close JabRef completely.
  4. Reopen JabRef.
  5. Verify the side pane width is restored to where you left it in step 2.

Checklist

  • 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 can be understood by the average user (if change is visible to the user)
  • [/] I checked the user documentation for up to dateness and submitted a pull request to our user documentation repository

Copilot AI review requested due to automatic review settings March 23, 2026 09:06
@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Fix side pane width not remembered after restart

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Fixed side pane width not persisting after JabRef restart
• Removed erroneous division of normalized divider position
• Horizontal divider now restored using normalized position directly
• Updated CHANGELOG with fix description
Diagram
flowchart LR
  A["Saved normalized divider position<br/>0-1 range"] -->|"Previously divided by<br/>pixel width"| B["Collapsed to near-zero"]
  A -->|"Now applied directly"| C["Correctly restored position"]
Loading

Grey Divider

File Changes

1. jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java 🐞 Bug fix +1/-2

Remove incorrect divider position normalization

• Removed erroneous division of getHorizontalDividerPosition() by horizontalSplit.getWidth()
• Normalized divider position is now applied directly to setDividerPositions()
• Aligns horizontal divider restoration with existing vertical divider logic

jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java


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

Document side pane width fix

• Added entry documenting the fix for side pane width persistence issue
• References issue #8907 with link to GitHub issue

CHANGELOG.md


Grey Divider

Qodo Logo

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

qodo-free-for-open-source-projects Bot commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 📐 Spec deviations (0)

Grey Divider


Remediation recommended

1. No divider value sanity-check 🐞 Bug ⛯ Reliability
Description
updateHorizontalDividerPosition restores the persisted divider position without validating it, so
users with previously-corrupted stored values (e.g., near-zero) will still get a collapsed side pane
after upgrading until they manually resize it again.
Code

jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java[R307-312]

    public void updateHorizontalDividerPosition() {
        if (mainStage.isShowing() && !sidePane.getChildren().isEmpty()) {
-            horizontalSplit.setDividerPositions(preferences.getGuiPreferences()
-                                                           .getHorizontalDividerPosition() / horizontalSplit.getWidth());
+            horizontalSplit.setDividerPositions(preferences.getGuiPreferences().getHorizontalDividerPosition());
            horizontalDividerSubscription = EasyBind.valueAt(horizontalSplit.getDividers(), 0)
                                                    .mapObservable(SplitPane.Divider::positionProperty)
                                                    .listenToValues((_, newValue) ->
Evidence
The horizontal divider restore now directly applies the stored preference value via
setDividerPositions(...), and the same method subscribes to divider position changes and persists
them. If the stored value is already out-of-range or extremely small, there is no fallback to a
default, so the UI will restore that bad value indefinitely.

jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java[307-315]
jabgui/src/main/java/org/jabref/gui/CoreGuiPreferences.java[35-45]

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

### Issue description
`JabRefFrame#updateHorizontalDividerPosition` restores the horizontal split divider position from preferences without any validation. If the stored preference value is corrupted (e.g., extremely small or not finite), the side pane will remain effectively collapsed until the user manually resizes.

### Issue Context
- Divider positions are normalized (0..1).
- There is a reasonable default (0.15) already defined in `CoreGuiPreferences`.

### Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java[307-315]
- jabgui/src/main/java/org/jabref/gui/CoreGuiPreferences.java[35-45]

### Suggested fix
- Before calling `horizontalSplit.setDividerPositions(...)`, validate the value:
 - if `Double.isNaN(value)` / `Double.isInfinite(value)` / `value &lt;= 0.01` / `value &gt;= 0.99` (thresholds as appropriate), fall back to `CoreGuiPreferences.getDefault().getHorizontalDividerPosition()`.
 - Optionally write the corrected value back into preferences so it self-heals.

ⓘ 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

@github-actions github-actions Bot added good first issue An issue intended for project-newcomers. Varies in difficulty. component: ui component: groups labels Mar 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes JabRef’s side pane (Groups/Web search) width persistence by correcting how the horizontal SplitPane divider position is restored from GUI preferences.

Changes:

  • Restore the horizontal divider position using the stored normalized (0–1) value directly (removing an erroneous division by pixel width).
  • Add a changelog entry documenting the fix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java Corrects divider restoration logic to use normalized JavaFX divider positions consistently.
CHANGELOG.md Documents the user-visible fix for side pane width persistence on restart.

@subhramit

subhramit commented Mar 23, 2026

Copy link
Copy Markdown
Member

Since @Sudeep-A-Kulkarni has spent some time gathering context on this, would you like to review this PR?
@saulsgrm feel free to review as well.

@testlens-app

This comment has been minimized.

@subhramit

Copy link
Copy Markdown
Member

@AnvitaPrasad I don't see JabRef restarting in any of the attached clips - could you update?

@AnvitaPrasad

Copy link
Copy Markdown
Contributor Author

@subhramit Just updated the PR description and added a clip showing the restart flow as well.

subhramit
subhramit previously approved these changes Mar 23, 2026

@subhramit subhramit 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.

LGTM

@ThiloteE

Copy link
Copy Markdown
Member

I tested this PR on:
Kernel: 6.8.0-106-generic arch: x86_64 bits: 64 compiler: gcc v: 13.3.0 clocksource: tsc
Desktop: Cinnamon v: 6.6.7 tk: GTK v: 3.24.41 wm: Muffin v: 6.6.3 vt: 7 dm: LightDM v: 1.30.0
Distro: Linux Mint 22.3 Zena base: Ubuntu 24.04 noble

Before (current main branch):
The side pane opens at ca. 80% on the right side of the screen, then snaps to the left. After manually adjusting the width and restarting, it still opens at ca. 80% on the right side of the screen, then snaps to a position at the left. NOT the position it was manually adjusted to in the prior run.

After:
The side pane opens at ca. 80% on the right side of the screen. After manually adjusting the width and restarting, it still opens at ca. 80% on the right side of the screen, but then snaps to the position that it was manually adjusted to in the prior run. 👍 I think it's an improvement.

@koppor

koppor commented Mar 23, 2026

Copy link
Copy Markdown
Member

The side pane opens at ca. 80% on the right side of the screen. After manually adjusting the width and restarting, it still opens at ca. 80% on the right side of the screen, but then snaps to the position that it was manually adjusted to in the prior run. 👍 I think it's an improvement.

Is this a solution to the issue?

I understand:

  • JabRef shows 80% alignment
  • user changes alignment to 90%
  • user restarts JabRef
  • JabRef shows 80% alignment, BUT should show 90% alignment?

@ThiloteE

ThiloteE commented Mar 23, 2026

Copy link
Copy Markdown
Member

No, it's ok, Oliver. It's as is shown in the third video.
Can be merged.

@subhramit

Copy link
Copy Markdown
Member

The side pane opens at ca. 80% on the right side of the screen. After manually adjusting the width and restarting, it still opens at ca. 80% on the right side of the screen, but then snaps to the position that it was manually adjusted to in the prior run. 👍 I think it's an improvement.

Is this a solution to the issue?

I understand:

  • JabRef shows 80% alignment
  • user changes alignment to 90%
  • user restarts JabRef
  • JabRef shows 80% alignment, BUT should show 90% alignment?

There is, according to Thilo, a slight delay but it does show 90% eventually (starts with 80%).

@calixtus calixtus added this pull request to the merge queue Mar 24, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Mar 24, 2026
@testlens-app

testlens-app Bot commented Mar 24, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: e30d4c6
▶️ Tests: 10203 executed
⚪️ Checks: 52/52 completed


Learn more about TestLens at testlens.app.

@calixtus calixtus enabled auto-merge March 24, 2026 19:26
@calixtus calixtus added this pull request to the merge queue Mar 24, 2026
@github-actions github-actions Bot added the status: to-be-merged PRs which are accepted and should go into the merge-queue. label Mar 24, 2026
Merged via the queue into JabRef:main with commit aa2b4a0 Mar 24, 2026
52 checks passed
Ranjeet2702 pushed a commit to Ranjeet2702/jabref that referenced this pull request Apr 14, 2026
…f#15390)

Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: groups component: ui good first issue An issue intended for project-newcomers. Varies in difficulty. status: no-bot-comments 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.

UI: web search/Groups width not remembered

6 participants