Repository navigation
Conversation
Shift+Tab from the text box of a CalendarDatePicker does not reach the previous control. The previous tab stop is the picker, and the picker moves focus back to its text box, so focus stays in the text box. The test fails until the picker leaves the tab order.
CalendarDatePicker is a tab stop, and it moves focus to its text box when it receives focus. Shift+Tab from the text box selects the picker as the previous tab stop, so focus returns to the text box and the keyboard cannot leave the picker backwards. Remove the picker from the tab order, as AutoCompleteBox and NumericUpDown do. Tab navigation then reaches the text box directly in both directions. The picker stays focusable, so pointer focus and Focus() calls behave as before. Fixes AvaloniaUI#15193
NathanDrake2406
marked this pull request as ready for review
October 2, 2026 02:06
NuGet packagesThe packages for this pull request have been published (workflow run):
|
maxkatz6
approved these changes
Oct 4, 2026
maxkatz6
left a comment
Member
There was a problem hiding this comment.
Consistent with NumericUpDown and AutoCompleteBox
grokys
pushed a commit
to Evan260/Avalonia
that referenced
this pull request
Oct 7, 2026
* test(datepicker): cover Shift+Tab out of CalendarDatePicker Shift+Tab from the text box of a CalendarDatePicker does not reach the previous control. The previous tab stop is the picker, and the picker moves focus back to its text box, so focus stays in the text box. The test fails until the picker leaves the tab order. * fix(datepicker): allow Shift+Tab out of CalendarDatePicker CalendarDatePicker is a tab stop, and it moves focus to its text box when it receives focus. Shift+Tab from the text box selects the picker as the previous tab stop, so focus returns to the text box and the keyboard cannot leave the picker backwards. Remove the picker from the tab order, as AutoCompleteBox and NumericUpDown do. Tab navigation then reaches the text box directly in both directions. The picker stays focusable, so pointer focus and Focus() calls behave as before. Fixes AvaloniaUI#15193 * chore: trim code comments
MrJul
pushed a commit
that referenced
this pull request
Oct 9, 2026
* test(datepicker): cover Shift+Tab out of CalendarDatePicker Shift+Tab from the text box of a CalendarDatePicker does not reach the previous control. The previous tab stop is the picker, and the picker moves focus back to its text box, so focus stays in the text box. The test fails until the picker leaves the tab order. * fix(datepicker): allow Shift+Tab out of CalendarDatePicker CalendarDatePicker is a tab stop, and it moves focus to its text box when it receives focus. Shift+Tab from the text box selects the picker as the previous tab stop, so focus returns to the text box and the keyboard cannot leave the picker backwards. Remove the picker from the tab order, as AutoCompleteBox and NumericUpDown do. Tab navigation then reaches the text box directly in both directions. The picker stays focusable, so pointer focus and Focus() calls behave as before. Fixes #15193 * chore: trim code comments
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.
What does the pull request do?
Lets the keyboard leave a
CalendarDatePickerbackwards withShift+Tab.What is the current behavior?
CalendarDatePickeris focusable and a tab stop. When the picker receives focus,OnGotFocusmoves focus toPART_TextBox.With focus in the text box,
Shift+Tabselects the picker as the previous tab stop. The picker then moves focus back to the text box. Focus never reaches the control before the picker.What is the updated/expected behavior with this PR?
Shift+Tabfrom the text boxTabinto the pickerShift+Tabinto the picker from the next controlTabfrom the text boxpicker.Focus()and pointer focusHow was the solution implemented (if it's not obvious)?
The static constructor overrides
IsTabStoptofalseforCalendarDatePicker. Tab navigation then treats the picker as a container and stops on the text box directly.AutoCompleteBoxandNumericUpDownalready do the same for the same reason: the control forwards focus to an inner text box.Focusablestaystrue, andOnGotFocusis unchanged. In the Fluent and Simple templates,PART_Buttonis not focusable andPART_Calendaris inside the popup. The text box is therefore the only tab stop in the picker, as before.The text selection on tab entry now comes from
TextBoxitself, which selects all text when it gets focus by tab.Validation
Shift_Tab_From_TextBox_Should_Move_Focus_To_Previous_Controlfails on the first commit and passes on the second commit.Tab_Into_CalendarDatePicker_Should_Focus_TextBox_And_Select_TextandShift_Tab_Into_CalendarDatePicker_Should_Focus_TextBoxguard entry into the picker from both directions.CalendarDatePickerTestsclass inAvalonia.Controls.UnitTests: 11 passed, 1 skipped (already skipped onmain).TabandShift+Tabkey presses across button, picker, button. Without the fix, the lastShift+Tableaves focus in the text box. With the fix, the cycle works in both directions. This check is not part of the PR.The test template now marks
PART_Buttonas not focusable, to match both built-in themes.Not in this PR
The issue also mentions inconsistent
Endkey behavior after the text is selected. This PR does not change that behavior.Checklist
Breaking changes
None in API. The default value of
IsTabStopforCalendarDatePickerchanges fromtruetofalse. A custom template without a focusable child no longer receives tab focus on the picker itself.Fixed issues
Fixes #15193