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.
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.
- relates to
-
JDK-8328577 Toolbar's overflow button overlaps the items
-
- Resolved
-