I'm calling toFront on a node present in a group. This causes a focus shift. But the newly focused node doesn't get key events. Reproducible with the attached test.
The test shows a Rectangle, TextBox and a swing Button. Initially the button has focus. When mouse clicked on the Rectangle, Rectangle.toFront is called. This causes the button to lose focus. TextBox looks as if it gained focus, but it doesn't respond when key pressed. Now, even after TextBox is clicked, it fails to respond to key events.
The test shows a Rectangle, TextBox and a swing Button. Initially the button has focus. When mouse clicked on the Rectangle, Rectangle.toFront is called. This causes the button to lose focus. TextBox looks as if it gained focus, but it doesn't respond when key pressed. Now, even after TextBox is clicked, it fails to respond to key events.