Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8287424

Mnemonics should not be triggered by Alt Graph key

    XMLWordPrintable

Details

    • x86_64
    • windows_10

    Description

      ADDITIONAL SYSTEM INFORMATION :
      Microsoft Windows [Version 10.0.17134.1040]
      openjdk version "13" 2019-09-17
      OpenJDK Runtime Environment AdoptOpenJDK (build 13+33)
      OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13+33, mixed mode, sharing)

      A DESCRIPTION OF THE PROBLEM :
      Typing 2 letters with accents using Alt Graph (holding it for 2 consequent letters) and typing one standard letter which is associated to mnemonic, causes the mnemonic to be turn on, although we haven't triggered mnemonic by single ALT press, but it was "remembered" from typing accented letters.

      com.sun.javafx.scene.KeyboardShortcutsHandler#dispatchCapturingEvent should check if the ALT_GRAPH is pressed and do not process mnemonic event for it.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Make sure that you have some language with accents, below code will be presenting sample for Polish language.
      1. Open MenuBarSample from given source code.
      2. Focus text field.
      3. Type "ććc" - Press AltGraph (right alt key) and double click "C" key, then release AltGraph and press "C" key.
      4. Clear text field value.
      5. Lose focus of application to ensure remove mnemonics.
      6. Focus text field.
      7. Type "óóo" - Press AltGraph (right alt key) and double click "O" key, then release AltGraph and press "O" key.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      After 3. the text field presents "ććc" value and there is no dialog opened or menu from MenuBar.
      After 7. the text field presents "óóo" value and there is no dialog opened or menu from MenuBar.

      ACTUAL -
      After 3. the text field presents "ććc" value, and the dialog/alert that is attached to Close button is opened.
      After 7. the text field presents "óóo" value and the mnemonic from "One" menu is triggered so the Menu is opened from MenuBar.


      ---------- BEGIN SOURCE ----------

      public class MenuBarSample
      {

          public static void main( String[] args )
          {
              System.err.println( Runtime.version().toString() );
              Application.launch( MenuBarSample.MainFx.class, args );
          }

          public static class MainFx extends Application
          {

              @Override
              public void start( final Stage primaryStage ) throws Exception
              {
                  System.err.println( System.getProperty( "javafx.version" ) );

                  final BorderPane borderPane = new BorderPane( new VBox( new TextField( "" ) ) );
                  final Menu one = new Menu( "_One" );
                  one.getItems().add( new MenuItem( "Sample 1" ) );
                  one.getItems().add( new MenuItem( "Sample 2" ) );
                  one.getItems().add( new MenuItem( "Sample 3" ) );
                  one.getItems().add( new MenuItem( "Sample 4" ) );
                  final var menuBar = new MenuBar( one, new Menu( "_Two" ), new Menu( "T_hree" ) );
                  borderPane.setTop( menuBar );
                  final var closeButton = new Button( "_Close" );
                  closeButton.setOnAction( event -> {
                      final var closeAction = new Alert( Alert.AlertType.INFORMATION );
                      closeAction.initOwner( primaryStage );
                      closeAction.show();
                  } );
                  borderPane.setBottom( closeButton );
                  Scene scene = new Scene( borderPane, 800, 600 );
                  primaryStage.setScene( scene );
                  primaryStage.show();
              }

          }

      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      consume "Alt Graph" key on TextFields/TextAreas

      FREQUENCY : always


      Attachments

        Activity

          People

            pnarayanaswa Praveen Narayanaswamy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: