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

Improve focus handling in Toolbar selection item in Mac

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P5 P5
    • tbd
    • jfx23
    • javafx
    • None
    • generic
    • os_x

      This issue was observed during the review of Toolbar's overflow button issue fix PR: https://github.com/openjdk/jfx/pull/1434#pullrequestreview-2010946097

      Issues observed are as follows:
      1. If a visible toolbar item is selected and we select an item from overflown list, both the items get marked as selected with blue outline. But overflow icon remains grey.
      2. If an item is selected and then change window size so that selected item moves to overflow list, overflow icon becomes blue. If we change the selection to another item in the overflow list, then overflow icon becomes grey. But on hovering anywhere in the window, overflow icon becomes blue again.
      3. If an item is selected in the overflow list and we select an item from the visible list, selection in the overflow list remains on opening the overflow list for the first time but overflow icon becomes grey. If we open overflow list again, selection will get removed.

      The issue can be reproduced either by using MonkeyTester or using the following source code

      ---------- BEGIN SOURCE ----------
      public class ToolbarOverflowButton extends Application {

          @Override
          public void start(Stage stage) throws Exception {
              ToolBar toolBar = new ToolBar();

              int i = 0;
              for (; i < 5; i++) {
                  Button b = new Button("-----");
                  b.setMinWidth(Region.USE_PREF_SIZE);
                  toolBar.getItems().add(b);
              }

              // This is a problematic component
              Button button = new Button();
              button.setMinWidth(Region.USE_PREF_SIZE);
              button.sceneProperty().addListener((ov, o, n) -> button.setText(n != null ? "- XXXX -" : null));
              toolBar.getItems().add(button);

              for (; i < 10; i++) {
                  Button b = new Button("-----");
                  b.setMinWidth(Region.USE_PREF_SIZE);
                  toolBar.getItems().add(b);
              }

              stage.setScene(new Scene(toolBar));
              stage.show();
          }
      }
      ---------- END SOURCE ----------

      Screen recording of the steps to reproduce the issue is attached.

        1. issue2.mp4
          1.03 MB
          Karthik P K
        2. issue3.mp4
          664 kB
          Karthik P K

            Unassigned Unassigned
            kpk Karthik P K
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: