[jfx17] RFR: 8240640: [macos] Wrong focus behaviour with multiple Alerts [v2]

Pankaj Bansal pbansal at openjdk.java.net
Fri Jul 23 17:33:12 UTC 2021


On Fri, 23 Jul 2021 00:16:33 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

> The fix (reverting the earlier fix for JDK-8227366) looks fine to me. The test runs fine on Mac (and mostly fine on Linux, but I need to test a couple more things).
> 
> I also see the failure on Windows frequently depending on whether the Window initially gets focus. One thing you might try is to call `stage.toFront()` and `stage.requestFocus()` before showing the Alerts, although I'm not sure that will help. For other tests like this we do set the primary stage to be always on top, so that's probably the easiest. Failing that you could mark the test as unstable on Windows.
> 
> Btw, on my slow Linux VM, it occasionally fails because the window takes a bit too long to come up. I'll do some more testing once you fix the Windows issue.
> 
> I left a couple formatting comments on the test inline.

I tried the stage.toFront or stage.requestFocus, they did not work. So I added the stage.setAlwaysOnTop(true). Along with that, I also added functionality to do mouse click at centre of alert to make sure keyboard focus is present on the alert. I have verified that the updated test fails before the fix and passes with the fix. I have tried multiple iterations of the test on all platforms (Mac 10.15, Ubuntu 20.04 and Windows 10) and test looks stable.

-------------

PR: https://git.openjdk.java.net/jfx/pull/581


More information about the openjfx-dev mailing list