The Behavior in JavaFX is currently responsible for signaling (to the Skin) when to stop animating the caret. It does this by wrapping every possible key press and key typed in a start/stop animating callback.
However, not only does this catch too many cases (cases where key presses don't lead to cursor position changes), it also fails to catch all caret position changes (key pad navigation for example does not stop the animation).
Furthermore, this is not a behavioral concern, which is clearly demonstrated by the fact that this is forwarded to the skin -- replacing the behavior should not break caret animation.
The rule for caret animation is pretty simple. The user needs to be able to see the caret immediately if it changes position, which means animation is temporarily reset to keep the caret visible while it moves (ie. when typing, or when navigating). This rule has been confirmed by looking at similar controls (Windows, Chrome). If the cursor doesn't move (like when using DELETE or navigation has reached the start/end position) then the blinking ALSO doesn't stop, which makes sense as the cursor position didn't change and so there is no need to "highlight" it for the user to see.
JavaFX's implementation breaks down in many of these cases due to its complicated handling of caret animation (basing it on keys pressed and typed, instead of cursor movement).
Solution:
Move caret animation handling to the Skin, by registering a listener on the caretPosition property. The animation should be restarted each time the caretPosition changes.
Clean-up all caret animation handling from the current internal behaviors.
However, not only does this catch too many cases (cases where key presses don't lead to cursor position changes), it also fails to catch all caret position changes (key pad navigation for example does not stop the animation).
Furthermore, this is not a behavioral concern, which is clearly demonstrated by the fact that this is forwarded to the skin -- replacing the behavior should not break caret animation.
The rule for caret animation is pretty simple. The user needs to be able to see the caret immediately if it changes position, which means animation is temporarily reset to keep the caret visible while it moves (ie. when typing, or when navigating). This rule has been confirmed by looking at similar controls (Windows, Chrome). If the cursor doesn't move (like when using DELETE or navigation has reached the start/end position) then the blinking ALSO doesn't stop, which makes sense as the cursor position didn't change and so there is no need to "highlight" it for the user to see.
JavaFX's implementation breaks down in many of these cases due to its complicated handling of caret animation (basing it on keys pressed and typed, instead of cursor movement).
Solution:
Move caret animation handling to the Skin, by registering a listener on the caretPosition property. The animation should be restarted each time the caretPosition changes.
Clean-up all caret animation handling from the current internal behaviors.
- relates to
-
JDK-8314968 Public InputMap (v3)
- In Progress
-
JDK-8343646 Public InputMap (Incubator)
- In Progress