- 
    Type:
Bug
 - 
    Resolution: Fixed
 - 
    Priority:
  P3                     
     - 
    Affects Version/s: jfx14
 - 
    Component/s: javafx
 
- 
        x86
 - 
        os_x
 
| Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build | 
|---|---|---|---|---|---|---|
| JDK-8271521 | jfx18 | Pankaj Bansal | P3 | Resolved | Fixed | 
                    ADDITIONAL SYSTEM INFORMATION :
MacOS 10.15.3
Java 11, OpenJFX14
A DESCRIPTION OF THE PROBLEM :
This is a regression introduced by:
JDK-8227366 : Wrong stage gets focused after modal stage creation
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8227366
If you have multiple alerts opened on a parent window, pressing the escape multiple times should close each alert in the order they were opened.
This worked correctly before the above linked fix forJDK-8227366 
REGRESSION : Last worked in version 13.0.2
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
* Run the attached test code which opens 3 Alerts on top of a parent Window.
* Press escape 3 times
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
All of the Alerts should have closed after pressing the escape key 3 times.
ACTUAL -
After the first press of the escape key once, the focus went to the parent Window meaning the last 2 Alerts remained open.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class FocusBug
{
public static void main(
String[] args)
{
Application.launch(FocusBugImpl.class);
}
    
public static class FocusBugImpl extends Application
{
private Stage mStage;
        
@Override
public void start(
Stage stage) throws Exception
{
mStage = stage;
final BorderPane root = new BorderPane();
            
stage.setScene(new Scene(root, 500, 500));
stage.show();
            
showAlert();
showAlert();
showAlert();
}
        
private void showAlert()
{
final Alert alert = new Alert(AlertType.INFORMATION);
alert.initOwner(mStage);
alert.show();
}
}
    
}
---------- END SOURCE ----------
FREQUENCY : always
            
MacOS 10.15.3
Java 11, OpenJFX14
A DESCRIPTION OF THE PROBLEM :
This is a regression introduced by:
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8227366
If you have multiple alerts opened on a parent window, pressing the escape multiple times should close each alert in the order they were opened.
This worked correctly before the above linked fix for
REGRESSION : Last worked in version 13.0.2
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
* Run the attached test code which opens 3 Alerts on top of a parent Window.
* Press escape 3 times
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
All of the Alerts should have closed after pressing the escape key 3 times.
ACTUAL -
After the first press of the escape key once, the focus went to the parent Window meaning the last 2 Alerts remained open.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class FocusBug
{
public static void main(
String[] args)
{
Application.launch(FocusBugImpl.class);
}
public static class FocusBugImpl extends Application
{
private Stage mStage;
@Override
public void start(
Stage stage) throws Exception
{
mStage = stage;
final BorderPane root = new BorderPane();
stage.setScene(new Scene(root, 500, 500));
stage.show();
showAlert();
showAlert();
showAlert();
}
private void showAlert()
{
final Alert alert = new Alert(AlertType.INFORMATION);
alert.initOwner(mStage);
alert.show();
}
}
}
---------- END SOURCE ----------
FREQUENCY : always
- backported by
 - 
                    
JDK-8271521 [macos] Wrong focus behaviour with multiple Alerts
-         
     - Resolved
 
 -         
 
- duplicates
 - 
                    
JDK-8269429 Linux: Only the last APPLICATION_MODAL window behaves correctly
-         
     - Closed
 
 -         
 
- relates to
 - 
                    
JDK-8227366 Wrong stage gets focused after modal stage creation
-         
     - Resolved
 
 -         
 - 
                    
JDK-8271054 [REDO] Wrong stage gets focused after modal stage creation
-         
     - Resolved
 
 -         
 - 
                    
JDK-8269429 Linux: Only the last APPLICATION_MODAL window behaves correctly
-         
     - Closed
 
 -         
 
             (2 links to)