Skip to content

Commit 160775f

Browse files
committed
Code Quality: Fixed issue with focusing the filter header
1 parent f995c73 commit 160775f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Files.App/Actions/Show/ToggleFilterHeaderAction.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ public ToggleFilterHeaderAction()
2828
generalSettingsService.PropertyChanged += GeneralSettingsService_PropertyChanged;
2929
}
3030

31-
public Task ExecuteAsync(object? parameter = null)
31+
public async Task ExecuteAsync(object? parameter = null)
3232
{
3333
generalSettingsService.ShowFilterHeader = !IsOn;
3434

3535
if (IsOn)
3636
{
37+
// Delay to ensure the UI updates before focusing
38+
await Task.Delay(100);
3739
var filterTextBox = (MainWindow.Instance.Content as Frame)?.FindDescendant("FilterTextBox") as AutoSuggestBox;
3840
filterTextBox?.Focus(FocusState.Programmatic);
3941
}
40-
41-
return Task.CompletedTask;
4242
}
4343

4444
private void GeneralSettingsService_PropertyChanged(object? sender, PropertyChangedEventArgs e)

0 commit comments

Comments
 (0)