fix(NumericUpDownAssist) & fix(SmoothScrollController)#89
Open
Huntk23 wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I think I found three undocumented behaviors I traced through the Avalonia 12 source on GitHub. None are flagged in the breaking-changes doc:
TextBox.OnKeyDownconsumes Up/Down arrows (the keyboard arrow keys bug)src/Avalonia.Controls/TextBox.cs - search for case
Key.Up: and caseKey.Down: Both callMoveVertical()and set a local movement flag, then at the end:For a single-line TextBox, Up now moves the caret to position 0 and Down moves it to end -- the caret position changes, movement = true, and the event gets swallowed before bubbling to the
ButtonSpinner. In Avalonia 11,MoveVerticalwas effectively a no-op for single-lineTextBoxes.NumericUpDown.OnSpinnerSpinrejects wheel-originated spins (the mouse-wheel bug)src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs - find
OnSpinnerSpin:For wheel events (UsingMouseWheel=true), spin only happens when
TextBox.IsFocusedreturns true. In Avalonia 12, focus appears to land on a child element of theTextBox(likely theTextPresenter) rather than theTextBoxitself, soTextBox.IsFocusedis false even when the caret is visible. TheIsFocusedcheck passes in Avalonia 11 but not 12. This is why our keyboard fix works (it raises Spin without UsingMouseWheel, taking the !e.UsingMouseWheel = true branch and skipping the focus check entirely).ButtonSpinner.OnPointerWheelChangedraises with UsingMouseWheel=truesrc/Avalonia.Controls/ButtonSpinner.cs - find
OnPointerWheelChanged:This is the producer side of bug # 2 - the
ButtonSpinneralways tags wheel-originated spins, which feeds into the brokenIsFocusedcheck above.Root cause summary: bugs # 1 and # 2 both stem from the same underlying Avalonia 12 change - focus and key handling shifted to inner template elements (TextPresenter, MoveVertical caret movement). Neither was called out as a breaking change because, in isolation, they look like correctness improvements. The regression only surfaces when you compose them via the TextBox/ButtonSpinner/NumericUpDown chain.
Fixes #88
Tested