-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Describe the bug
Because of this code the list is not found when we try to focus it.
WindowsCommunityToolkit/Microsoft.Toolkit.Uwp.UI.Controls.Layout/ListDetailsView/ListDetailsView.cs
Lines 406 to 412 in 5dfc575
private void FocusItemList() | |
{ | |
if (GetTemplateChild("PartMainList") is Control list) | |
{ | |
list.Focus(FocusState.Programmatic); | |
} | |
} |
We try to focus the list here, if the ViewState
is not ListDetailsViewState.Details
WindowsCommunityToolkit/Microsoft.Toolkit.Uwp.UI.Controls.Layout/ListDetailsView/ListDetailsView.cs
Lines 375 to 389 in 5dfc575
/// <summary> | |
/// Sets focus to the relevant control based on the viewState. | |
/// </summary> | |
/// <param name="viewState">the view state</param> | |
private void SetFocus(ListDetailsViewState viewState) | |
{ | |
if (viewState != ListDetailsViewState.Details) | |
{ | |
FocusItemList(); | |
} | |
else | |
{ | |
FocusFirstFocusableElementInDetails(); | |
} | |
} |
The only call site for SetFocus is this
WindowsCommunityToolkit/Microsoft.Toolkit.Uwp.UI.Controls.Layout/ListDetailsView/ListDetailsView.cs
Line 371 in 5dfc575
SetFocus(ViewState); |
So we only ever use the ViewState
prop.
TODO: elaborate the cases when the ViewState
is not Details
A clear and concise description of what the bug is.
- Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work:
Steps to Reproduce
- Can this be reproduced in the Sample App? (Either in a sample as-is or with new XAML pasted in the editor.) If so, please provide custom XAML or steps to reproduce. If not, let us know why it can't be reproduced (e.g. more complex setup, environment, dependencies, etc...)
Steps to reproduce the behavior:
- Given the following environment (Sample App w/ XAML, Project with Isolated setup, etc...)
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior
Screenshots
Environment
NuGet Package(s):
Package Version(s):
Windows 10 Build Number:
- Fall Creators Update (16299)
- April 2018 Update (17134)
- October 2018 Update (17763)
- May 2019 Update (18362)
- May 2020 Update (19041)
- Insider Build ({build_number})
App min and target version:
- Fall Creators Update (16299)
- April 2018 Update (17134)
- October 2018 Update (17763)
- May 2019 Update (18362)
- May 2020 Update (19041)
- Insider Build ({build_number})
Device form factor:
- Desktop
- Xbox
- Surface Hub
- IoT
Visual Studio version:
- 2017 (15.{minor_version})
- 2019 (16.{minor_version})
- 2022 (17.{minor_version})