Skip to content
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

Focus entry editor tab when opening entry editor #3052

Closed
Siedlerchr opened this issue Jul 26, 2017 · 7 comments
Closed

Focus entry editor tab when opening entry editor #3052

Siedlerchr opened this issue Jul 26, 2017 · 7 comments

Comments

@Siedlerchr
Copy link
Member

Open entry editor.
Tab is not focused, Press CTRL+ PLUS or CTRL+ Minus to navigate: Notice that focus is still on table and therefore changes the size.

You first have to click on the tab or in a field to focus it and therefore make the navigation work correctly.

@lenhard lenhard changed the title Foucs entry editor tab when opening entry editor Focus entry editor tab when opening entry editor Jul 27, 2017
@halx4
Copy link
Contributor

halx4 commented Jul 29, 2017

Hello, I currently taking a shot on this one and would like some clarification.
After opening the entry editor, the focus should go to the tab of entry editor or to a field?

I think the field solution is more sensible as the user can, at this point, start typing as well as changing tab but if the focus goes to tab, the user has to press TAB button to start typing.
Thank you!

@Siedlerchr
Copy link
Member Author

Thanks for your interest in this, I agree the field solution would be more useful. So the focus then should go to the first field on that page.

If you need help or have any further questions on this, just ask.

@halx4
Copy link
Contributor

halx4 commented Jul 31, 2017

hi Siedlerchr,
Initially I tried to propagate the requestFocus() invocation down the hierarchy of nodes, checking in every step that everything is ok. After initialization , I press the "new BibTeX Library" and immediately the
"new BibTeX entry" button. The focus goes away from the last button I pressed and goes to another item in the UI.
It is working as expected until (inclusively) I request focus from EntryEditor (which extends a JPanel), meaning when I invoke super.requestFocus(), inside EntryEditor, the EntryEditor gets the focus properly.
The hierarchy of elements continues as follows:
EntryEditor has a JFXPanel and inside the JFXPanel is a scene which has a TabPane wich has EntryEditorTabs etc...
The problem is that when I propagate the requestFocus() call on a child of EntryEditor, the focus does not change (it stays on the last button I pressed).
I have checked that all the parents of the nodes I try to give focus to are visible which is a requirement according to javadocs. I tried enclosing requestFocus() callings in Platform.runLater(); with no luck.

I am thinking the fact that UI hierarchy consists of mixed swing and javaFX elements maybe has something to do with my problem.

I created a branch to demonstrate the problem named problemDemonstration. I would expect the focus to go to the EntryEditor's first tab but it does not.

Any help would be greatly appreciated! Thanks!

@Siedlerchr
Copy link
Member Author

Hi,
thanks for investigating this. You are probably right with the focus problem being part of the swing/javafx interoperability.
Maybe it's related to this bug?
https://bugs.openjdk.java.net/browse/JDK-8090000

Could be same reason for #3062

@tobiasdiez
Copy link
Member

@halx4 did you tried calling requestFocus also on the JFXPanel? See 973b127 for a fix of a very similar issue.

@halx4
Copy link
Contributor

halx4 commented Aug 8, 2017

@tobiasdiez thank you very much for your comment, it was very helpful.
I tried requesting focus on the JFXPanel and the focus is given implicitly to a focusTraversable node contained in the JFXPanel. The selection of the node seems to be "random" (even though consistent for a given tree of nodes). As far as I've tested it focuses the first Textfield on any tab which is the desired behavior but it is not guaranteed to stay like this if something changes in the nodes hierarchy or design.

The behavior described above can be demonstrated in this branch:
https://github.com/halx4/jabref/tree/entryEditorFocusFix

@Siedlerchr how should I proceed? should I prepare a pull request based on this solution or should I try to figure out how to make it give focus on the preferred node by explicitly declaring it for each tab?

@Siedlerchr
Copy link
Member Author

Siedlerchr commented Aug 8, 2017 via email

@halx4 halx4 mentioned this issue Aug 10, 2017
6 tasks
tobiasdiez pushed a commit that referenced this issue Aug 10, 2017
* fix Focus entry editor's text field when opening entry editor (#3052)

* add entry for fixing (#3052) to changelog.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants