-
-
Notifications
You must be signed in to change notification settings - Fork 3k
ESC closes the preferences dialog when editing table. #14106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…by cell-based controls (ListView/TableView/TreeView/TreeTableView)
I am not sure about your aims. Just get a PR merged (which is OK!) or to learn something about SE? In case of the latter, how can a tester follow these steps? How precise is "aligns with the expectations"? |
Hi Koppor, I am sorry for not mentioning test steps clearly. I have made changes in that part of description. I am new to OSS, I have never done something like this before. And I'll take care of all these things in the future projects. |
Also, can you please help me with the check that is failing because I am not understanding why it is happening? I tried to follow the documentation and the jabref-machine comment above but it didn't fix it. |
You just need to link the issue you fixed to this PR. |
Thanks for the reply, Subhramit. I followed what you suggested, but its still same. Is there anything else you think that is causing issues? |
Look at the example in the PR template (this is the text that appeared in the PR description when you first opened the PR, which you had to replace): Or the examples in the jabref-machine bot message:
It says either link using Or what I said in my comment above:
Instead of Hope this is clear now. P.S. Furthermore, the link that you provided in the brackets is not even a proper link to the issue, but a link to a comment on the issue. |
Thanks, it makes sense to me now. Sorry to bother you again but I have tried everything now. I added Closes but it is still failing. I also tried Fixes xyz, Fixes and Closes xyz, but it didn't work. |
|
ignore the PR issue number, I think it sometimes doesn't work when you modify the original pr text |
Will our PR still be accepted and merged? |
|
Your pr will be reviewed and tested. Takes time, as we all are working full time and do JabRef in the spare time. Please be patient. |
Hi Vishakha, no issues, thanks for pointing this out. There was an issue with our workflow that it didn't re-run on editing the PR description. Should be fixed by #14121. |
|
Hi there, I am just trying to follow up on this PR, since all the checks are passing now and all the previous issues have been fixed. Can you please let me know if there is any feedback or further changes we need to make? |
|
Please go through the mandatory checks and act on what is applicable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some feedback on your changes.
You can address them.
However, since the code appears to be heavily written by AI, other maintainers will take a call whether to move forward with this PR.
| var root = getDialogPane(); | ||
|
|
||
| for (var n : root.lookupAll(".list-view")) { | ||
| if (n instanceof javafx.scene.control.ListView<?> lv && lv.getEditingIndex() != -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use imports instead of raw library references.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also avoid abbreviations
| } | ||
|
|
||
| private void installGlobalCloseBehavior() { | ||
| var scene = getDialogPane().getScene(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We avoid var and use explicit types
| for (var n : root.lookupAll(".table-view")) { | ||
| if (n instanceof javafx.scene.control.TableView<?> tv && tv.getEditingCell() != null) { | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| for (var n : root.lookupAll(".tree-view")) { | ||
| if (n instanceof javafx.scene.control.TreeView<?> trv && trv.getEditingItem() != null) { | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| for (var n : root.lookupAll(".tree-table-view")) { | ||
| if (n instanceof javafx.scene.control.TreeTableView<?> ttv && ttv.getEditingCell() != null) { | ||
| return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comments applicable here
| // BaseDialog.java | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rationale behind this comment? Why was this file touched?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rationale behind this comment? Why was this file touched?
In the beginning, when we were trying to understand what triggered the bug, we thought that BaseDialog.java might have some role to play because the ESC was not closing a dialog, although we were wrong, as it was in the Preferences tab. But, we didn't make any changes in the code of this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, shall we change our implementation? Will changing the code make a difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but why was this comment added ^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry, I think the comment was added by mistake because I am not able to recall the reason behind adding it. It has now been removed in the new commit. I apologize for the oversight.
We got rid of the previous implementation and added a new one. |
Apologies for the sloppy code in the initial fix, we should have better familiarised ourselves with the proper coding style. And yes, AI was used in the original code - we were not aware that was against JabRef's contribution policy, apologies again. Our new code hopefully remedies both these concerns as AI wasn't used this time around and I believe we have used proper coding style. Thanks for your review in advance. |
Closes #8888
Issue
The issue was that, earlier when we opened the citation key generator in the preferences and pressing esc did not close the dialog when we were inside the table of key patterns. For example, clicking on Article and then pressing esc didn't close the preference dialog. This was a bug.

Fix
What we tried to do was implement consistent functionality of esc across the table.
If we the table in preference dialog is being edited, and somebody wants to escape in between, pressing first esc clears the changes and second esc closes the dialog view. We used JavaFX and created event filter on the dialog scene (installGlobalCloseBehavior). It checks whether any table or list is being edited, if it is so, then first esc cancels the changes, otherwise close the dialog.
Steps to test
Test plan: Preferences dialog close behaviour (ESC vs edit)
Note: The below assumes ESC is bound to the Close dialog keyboard shortcut
A. Baseline: ESC closes when not editing
Expected: The Preferences dialog closes.
B. Two-step ESC while editing (table)
Expected: Edit is cancelled; dialog stays open and the cell exits edit mode.
Expected: The Preferences dialog closes.
C. Other affected tabs (similar issue)
Repeat B in tabs (such as ‘Protected terms files’ and ‘Entry types) had the same incorrect close behaviour with TableView elements:
• Protected terms files → Select a cell in the table: start editing a row → ESC once cancels edit, ESC twice closes dialog.
• Entry types → Select a Entry Type on the left (e.g., ‘Article’) → Select a cell in the Required and optional fields table: start editing a row → ESC once cancels edit, ESC twice closes dialog.
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)