jabref icon indicating copy to clipboard operation
jabref copied to clipboard

When opening JabRef, Ctrl+W does not behave as expected.

Open priyanshu16095 opened this issue 10 months ago • 9 comments

JabRef version

5.15 (latest release)

Operating system

Windows

Details on version and operating system

No response

Checked with the latest development build (copy version output from About dialog)

  • [x] I made a backup of my libraries before testing the latest development version.
  • [x] I have tested the latest development version and the problem persists

Steps to reproduce the behaviour

There is a bug in the Ctrl+W shortcut. Instead of closing the current tab, it always closes the first tab in JabRef.

  1. Open JabRef.
  2. Use Ctrl+W key.
  3. It will close the first tab, instead of current tab.

https://github.com/user-attachments/assets/f204b442-20a3-477b-b991-2967becf6680

priyanshu16095 avatar Feb 19 '25 12:02 priyanshu16095

On my Ubuntu 24.04, I've observed this effect as well. I've traced it to the CloseDatabaseAction class in the file java/org/jabref/gui/frame/JabRefFrame.java, where the logic for close current library is implemented.

However, when running the program, it seems to only close the libraryTab member variable ( Only execute the code within the green box in the following figure ). However, libraryTab is always the first tab, not the current tab. And after closing, it does not update libraryTab. This results in the next use of Ctrl+W not being able to close the newest first tab, effectively doing nothing.

Image

I have currently only located the position where the error occurs, and I haven't delved into it deeply yet. I haven't understood the significance of libraryTab at the moment.

I think we need to change it to use only tabContainer.getCurrentLibraryTab().

urlyy avatar Feb 22 '25 14:02 urlyy

/assign-me

urlyy avatar Feb 22 '25 15:02 urlyy

👋 Hey @urlyy, thank you for your interest in this issue! 🎉

We're excited to have you on board. Start by exploring our Contributing guidelines, and don't forget to check out our workspace setup guidelines to get started smoothly.

In case you encounter failing tests during development, please check our developer FAQs!

Having any questions or issues? Feel free to ask here on GitHub. Need help setting up your local workspace? Join the conversation on JabRef's Gitter chat. And don't hesitate to open a (draft) pull request early on to show the direction it is heading towards. This way, you will receive valuable feedback.

Happy coding! 🚀

⏳ Please note, you will be automatically unassigned if the issue isn't closed within 90 days (by 23 May 2025). A maintainer can also add the "📌 Pinned"" label to prevent automatic unassignment.

github-actions[bot] avatar Feb 22 '25 15:02 github-actions[bot]

I apologize. I would like to unassign myself from this issue.Due to various reasons that have kept me quite busy, I won't be able to continue working on this issue. Just allowing others to contribute and solve this issue as soon as possible.

urlyy avatar Mar 03 '25 08:03 urlyy

/unassign-me

urlyy avatar Mar 05 '25 03:03 urlyy

👋 Hey @urlyy, you've been automatically unassigned from this issue due to inactivity.

[!NOTE] If you'd like to be re-assigned, just leave another comment or ask a maintainer to assign you again. If you're still actively working on the issue, let us know by commenting, and we can pin it to prevent automatic unassignment.

github-actions[bot] avatar Mar 05 '25 03:03 github-actions[bot]

/assign-me

AashifAmeer avatar Mar 08 '25 18:03 AashifAmeer

👋 Hey @AashifAmeer, thank you for your interest in this issue! 🎉

We're excited to have you on board. Start by exploring our Contributing guidelines, and don't forget to check out our workspace setup guidelines to get started smoothly.

In case you encounter failing tests during development, please check our developer FAQs!

Having any questions or issues? Feel free to ask here on GitHub. Need help setting up your local workspace? Join the conversation on JabRef's Gitter chat. And don't hesitate to open a (draft) pull request early on to show the direction it is heading towards. This way, you will receive valuable feedback.

Happy coding! 🚀

⏳ Please note, you will be automatically unassigned if the issue isn't closed within 45 days (by 22 April 2025). A maintainer can also add the "📌 Pinned"" label to prevent automatic unassignment.

github-actions[bot] avatar Mar 08 '25 18:03 github-actions[bot]

Other steps to reproduce:

  1. State in JabRef:
    Image
  2. I press Ctrl+W
  3. State in JabRef:
    Image
  4. I press Ctrl+W
  5. Nothing happens
  • Expected JabRef should close the current library

koppor avatar May 19 '25 08:05 koppor

I think this issue is similar to this question. If the JavaFX tabs share the same KeyCombination, only the last tab that the accelerator is set will trigger the event.

I reproduced the issue with a new project with 3 tabs. When F3 is pressed, no matter which tab I select, "Action3" is always printed. If "Tab 3" is closed and F3 is pressed, nothing will happen. This behavior is similar but opposite to the issue we have here, where the first tab is always closed at the first time Ctrl+W is pressed. I am still looking into it why this happened.

New project to reproduce the issue in stackoverflow:

public class HelloApplication extends Application {

    @Override
    public void start(Stage stage) {

        TabPane tabPane = new TabPane();
        tabPane.getTabs().addAll(
                createTab("Tab 1", "Action1"),
                createTab("Tab 2", "Action2"),
                createTab("Tab 3", "Action3")
        );
        tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.SELECTED_TAB);
        stage.setScene(new Scene(tabPane));
        stage.show();
    }

    private static Tab createTab(String tabTitle, String actionName) {
        Tab tab = new Tab(tabTitle);
        TableView<Void> table = new TableView<>();
        tab.setContent(table);

        Action action = new Action(actionName, e -> System.out.println(actionName));
        action.setAccelerator(KeyCombination.valueOf("F3"));

        MenuItem mi = new MenuItem(actionName);
        mi.acceleratorProperty().bind(action.acceleratorProperty());
        mi.setOnAction(action);

        ContextMenu ctx = new ContextMenu(mi);
        table.setContextMenu(ctx);

        return tab;
    }

}

josephyim avatar Oct 03 '25 04:10 josephyim

@josephyim Thank you for finding some external resources on that!

JDK issue linked from the SO question: https://bugs.openjdk.org/browse/JDK-8088068

koppor avatar Oct 03 '25 11:10 koppor

/assign-me

josephyim avatar Oct 09 '25 08:10 josephyim

👋 Hey @josephyim, thank you for your interest in this issue! 🎉

We're excited to have you on board. Start by exploring our Contributing guidelines, and don't forget to check out our workspace setup guidelines to get started smoothly.

For questions on JabRef functionality and the code base, you can consult the JabRef Guru or ask on our Gitter chat.

In case you encounter failing tests during development, please check our developer FAQs!

Having any questions or issues? Feel free to ask here on GitHub. Need help setting up your local workspace? Join the conversation on JabRef's Gitter chat. And don't hesitate to open a (draft) pull request early on to show the direction it is heading towards. This way, you will receive valuable feedback.

Happy coding! 🚀

github-actions[bot] avatar Oct 09 '25 08:10 github-actions[bot]

I made these changes It will work as expected except the shortcut key is no longer shown in the context menu because I have removed the key combination from the context menu. @koppor What do you think? If this is acceptable, I can do similar for "Open terminal here".

Image

josephyim avatar Oct 09 '25 08:10 josephyim

⏰ Assignment Reminder

Hi @josephyim, this is a friendly reminder about your assignment to this issue.

[!WARNING] This issue will be automatically unassigned in 11 days if there's no activity.

Remember that you can ask the JabRef Guru or DeepWiki about anything regarding JabRef. Additionally, our contributing guide has hints on creating a pull request and a link to our Gitter chat.

How to keep your assignment


If you are working on it, you can prevent automatic unassignment by:

  • Submitting a draft pull request with your progress within 11 days
  • Asking for the 📌 Pinned label if you need more time

We appreciate your contribution and are here to help if needed!

github-actions[bot] avatar Oct 18 '25 12:10 github-actions[bot]

We think that this issue was fixed. Please head to https://builds.jabref.org/main to download a development build and try it out.

For any feedback, add a comment to the pull request at https://github.com/JabRef/jabref/pull/14104.

github-actions[bot] avatar Oct 19 '25 13:10 github-actions[bot]