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

[ListView] List with focusTraversable=false can get focus anyway

    XMLWordPrintable

Details

    Description

      Unfocusable ListView can get focused by clicking on its scroll bar.

      Code to reproduce the issue:

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.ListView;
      import javafx.stage.Stage;

      public class ListViewFocus extends Application
      {

      @Override
      public void start(final Stage stage) throws Exception
      {
      final ListView<String> listView = new ListView<>();
      listView.setPrefHeight(150.0);
      listView.getItems().addAll("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o");
      listView.setFocusTraversable(false);

      stage.setScene(new Scene(listView));
      stage.show();
      }

      public static void main(final String[] args)
      {
      Application.launch(args);
      }

      }

      To see the problem, click on the ListView vertical scroll bar.

      Attachments

        Activity

          People

            jgiles Jonathan Giles
            jsmucrjfx Jan Smucr (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: