For other nodes with tooltips, -fx-show-delay is not applied until their tooltips are displayed once, which happens using the default delay time of 1000 ms.
The attached test case, with just this css style:
.tooltip {
-fx-show-delay: 10ms;
}
shows the issue, after doing the following steps:
- Start application
- Hover over button 1 repeatedly (without waiting 1 second), see the output:
Tooltip 1 delay: 1000.0 ms
Tooltip 1 shown
Tooltip 1 shown
Tooltip 1 delay: 10.0 ms
Tooltip 1 shown
Tooltip 1 delay: 10.0 ms
Tooltip 1 shown
Tooltip 1 delay: 10.0 ms
Tooltip 1 shown
...
every time the mouse is over the button 1, the tooltip 1 is displayed, and with the expected 10 ms delay.
- Hover over button 2 repeatedly (without waiting 1 second), see the output:
Tooltip 2 delay: 1000.0 ms
Tooltip 2 delay: 1000.0 ms
Tooltip 2 delay: 1000.0 ms
Tooltip 2 delay: 1000.0 ms
...
the tooltip 2 is never displayed, which is unexpected.
- Hover over button 2 again, wait one second, and then enter/exit repeatedly (without waiting 1 second), see the output:
Tooltip 2 delay: 1000.0 ms
Tooltip 2 shown
Tooltip 2 delay: 10.0 ms
Tooltip 2 shown
Tooltip 2 delay: 10.0 ms
Tooltip 2 shown
Tooltip 2 delay: 10.0 ms
Tooltip 2 shown
...
After waiting one second, the tooltip 2 is displayed, and then it will always take the expected 10 ms.
There is a cssForced [1] flag that forces the CSS processing in TooltipBehavior, but that is only applied for the first tooltip that requires it, because TooltipBehavior is a static class shared by all nodes with tooltips.
(this CSS processing explains why the first time the tooltip 1 from the above test is displayed it is shown twice)
This issue can be reproduced with any JavaFX version since 9.
[1] https://github.com/openjdk/jfx/blob/master/modules/javafx.controls/src/main/java/javafx/scene/control/Tooltip.java#L1001
The attached test case, with just this css style:
.tooltip {
-fx-show-delay: 10ms;
}
shows the issue, after doing the following steps:
- Start application
- Hover over button 1 repeatedly (without waiting 1 second), see the output:
Tooltip 1 delay: 1000.0 ms
Tooltip 1 shown
Tooltip 1 shown
Tooltip 1 delay: 10.0 ms
Tooltip 1 shown
Tooltip 1 delay: 10.0 ms
Tooltip 1 shown
Tooltip 1 delay: 10.0 ms
Tooltip 1 shown
...
every time the mouse is over the button 1, the tooltip 1 is displayed, and with the expected 10 ms delay.
- Hover over button 2 repeatedly (without waiting 1 second), see the output:
Tooltip 2 delay: 1000.0 ms
Tooltip 2 delay: 1000.0 ms
Tooltip 2 delay: 1000.0 ms
Tooltip 2 delay: 1000.0 ms
...
the tooltip 2 is never displayed, which is unexpected.
- Hover over button 2 again, wait one second, and then enter/exit repeatedly (without waiting 1 second), see the output:
Tooltip 2 delay: 1000.0 ms
Tooltip 2 shown
Tooltip 2 delay: 10.0 ms
Tooltip 2 shown
Tooltip 2 delay: 10.0 ms
Tooltip 2 shown
Tooltip 2 delay: 10.0 ms
Tooltip 2 shown
...
After waiting one second, the tooltip 2 is displayed, and then it will always take the expected 10 ms.
There is a cssForced [1] flag that forces the CSS processing in TooltipBehavior, but that is only applied for the first tooltip that requires it, because TooltipBehavior is a static class shared by all nodes with tooltips.
(this CSS processing explains why the first time the tooltip 1 from the above test is displayed it is shown twice)
This issue can be reproduced with any JavaFX version since 9.
[1] https://github.com/openjdk/jfx/blob/master/modules/javafx.controls/src/main/java/javafx/scene/control/Tooltip.java#L1001
- relates to
-
JDK-8090477 Customizable visibility timing for Tooltip
-
- Resolved
-
-
JDK-8330186 CSS: Persistent ClassCastException
-
- Open
-
-
JDK-8330187 Tooltip: Tooltip might disappear under certain conditions
-
- Open
-
- links to
-
Commit(master) openjdk/jfx/5b448b8b
-
Review(master) openjdk/jfx/1394