When opening JabRef, Ctrl+W does not behave as expected.
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.
- Open JabRef.
- Use Ctrl+W key.
- It will close the first tab, instead of current tab.
https://github.com/user-attachments/assets/f204b442-20a3-477b-b991-2967becf6680
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.
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().
/assign-me
👋 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.
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.
/unassign-me
👋 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.
/assign-me
👋 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.
Other steps to reproduce:
- State in JabRef:
- I press Ctrl+W
- State in JabRef:
- I press Ctrl+W
- Nothing happens
- Expected JabRef should close the current library
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 Thank you for finding some external resources on that!
JDK issue linked from the SO question: https://bugs.openjdk.org/browse/JDK-8088068
/assign-me
👋 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! 🚀
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".
⏰ 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!
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.