Context menu appearing on empty library table body#15396
Context menu appearing on empty library table body#15396calixtus merged 11 commits intoJabRef:mainfrom
Conversation
Review Summary by QodoFix context menu appearing on empty library table body
WalkthroughsDescription• Fix context menu appearing on empty library table body • Replace StackPane target check with proper column header detection • Add recursive parent traversal to identify TableColumnHeader nodes • Prevent context menu from showing on non-header table areas Diagramflowchart LR
A["Context Menu Event"] --> B["Check Event Target"]
B --> C["isColumnHeaderTarget Method"]
C --> D["Traverse Node Parents"]
D --> E{"TableColumnHeader Found?"}
E -->|Yes| F["Show Context Menu"]
E -->|No| G["Hide Context Menu"]
File Changes1. jabgui/src/main/java/org/jabref/gui/maintable/MainTableHeaderContextMenu.java
|
Code Review by Qodo
1.
|
|
So after these changes, the context menu doesn't close after clicking on the table body. If you click anywhere else except the table body it does close. Do you think it is needed to make the Table body area clickable to close the context menu? |
This comment has been minimized.
This comment has been minimized.
| if (!(eventTarget instanceof Node node)) { | ||
| return false; | ||
| } | ||
| while (node != null) { |
This comment has been minimized.
This comment has been minimized.
| } | ||
| return false; | ||
| return node.getStyleClass().contains("column-header") | ||
| || (node.getParent() != null && node.getParent().getStyleClass().contains("column-header")); |
There was a problem hiding this comment.
This change is nonsense.
instanceof was just fine
C'mon, use your brain, not an LLM.
There was a problem hiding this comment.
My bad was in a rush so opted for a quick fix... I should have reviewed it. I'll revert to the instanceof and make the requested changes when I get back home.
There was a problem hiding this comment.
JabRef is not about getting things done fast. There is no "race" or competition.
There was a problem hiding this comment.
I totally understand that and I promise I would never blindly make AI generated changes. It's just that I was going on a hike for 2-3 days and wouldn't have had access to work on the issue until the weekend. I'm really sorry about it. I always usually take my time reviewing everything precisely, this was a one time mistake and won't happen again.
There was a problem hiding this comment.
That is totally ok, quick note about a few days not available, we put the pr on waiting an you have a good time hiking. Just don't make bs commits in a hurry. That's just a waste of your and our time.
As soon as you are back we can finish the pr. Have a good time.
There was a problem hiding this comment.
Thank you so much for understanding... I wouldn't wanna waste your guys time on AI generated PRs either. I'm sorry once again. I'll be back in 2 days and get back on it.
|
Your pull request conflicts with the target branch. Please merge with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line. |
This comment has been minimized.
This comment has been minimized.
✅ All tests passed ✅🏷️ Commit: 0969675 Learn more about TestLens at testlens.app. |
@calixtus I've updated the method to use instanceof and it checks the target and its immediate parent instead of looping now too. Should I also add this functionality that I discussed above? |
Related issues and pull requests
Closes #15384
PR Description
When the library is empty, right clicking the table body was triggering the column chooser context menu. This was happening because the placeholder VBox has no context menu handler, so the ContextMenuEvent bubbled up to the MainTable level
handler which showed the menu unconditionally for any non StackPane target.
Steps to test
Checklist
CHANGELOG.mdin a way that can be understood by the average user (if change is visible to the user)