RFR: 8296621: Stage steals focus on scene change
Thiago Milczarek Sayao
tsayao at openjdk.org
Sat Nov 12 17:16:00 UTC 2022
On Wed, 9 Nov 2022 00:53:19 GMT, Thiago Milczarek Sayao <tsayao at openjdk.org> wrote:
> Simple fix to not requestFocus() on scene change.
>
> The attached bug sample shows that the TextField focused on the scene remains focused when the scene comes back.
> I agree that changing from one scene to another should not cause a new request focus call. My only concern is to ensure that this will not cause any regressions for the initial setting of a scene. A safer change might be to qualify the existing call to `requestFocus` with a check of the previous scene, and only call it if `oldScene == null`.
>
> /reviewers 2
The reason I found this is that `requestFocus()` in glass native side was being called before the window was visible. I'm not sure about windows or macos, but requesting focus on a unmapped window doesn't work (on Linux) and it seems logical to me. Considering that the usual scenario is to `setScene()` and then `show()`.
-------------
PR: https://git.openjdk.org/jfx/pull/940
More information about the openjfx-dev
mailing list