amwx/FluentAvalonia

Task Dialog Hijacking Focus

Closed this issue · 0 comments

Describe the bug
The TaskDialog uses OnLoaded to pull focus to either the default button, or the next item from KeyboardNavigationHandler. The issue is that when navigating between pages, once a component that has a TaskDialog with no default button specified in the XAML is loaded, the focus is pulled to the task dialog and then routed to the next item from the KeyboardNavigationHandler. This occurs without the TaskDialog being opened.

Desktop/Platform (please complete the following information):

  • OS: Windows 10 & Windows 11 (Occurs on both)
  • FluentAvalonia Version: 2.0.5 (latest)
  • Avalonia Version: 11.0.10 (latest)

Additional context
The only way to avoid this behavior is to have a default button specified (which is not ideal for cases where the task dialog may contain a form to input data and when a user presses enter to submit a line of data we may not want to close the dialog from that), or to generate the TaskDialog in the code-behind to prevent the OnLoaded event from firing when the hosting component is rendered.