MaterialDesignInXamlToolkit icon indicating copy to clipboard operation
MaterialDesignInXamlToolkit copied to clipboard

DialogHost dialog keyboard focus is lost to controls behind after using Alt+Tab to switch app

Open hfann opened this issue 2 years ago • 1 comments

If you use Alt+Tab to switch to another app and back while a DialogHost dialog is opened, the keyboard focus is gone to the controls behind the dialog. The only way to get keyboard focus back in the dialog is to use the mouse to click on a control in the dialog. This is a major usability problem and using MaterialDesignEmbeddedDialogHost is not an option because my dialog is large.

To reproduce the problem:

  1. Open the WPF main demo app.
  2. Open the hamburger menu and select Dialogs.
  3. Click on the Run Code button.
  4. Note the focus is on the Name field.
  5. Press Alt+Tab to switch to another app.
  6. Press Alt+Tab to switch back to the demo app.
  7. Press Tab key to a few times and you will see the focus rectangles are on the controls behind the dialog. You can't Tab your way back to the dialog.

When switching back to the app, the window hosting the DialogHost gets the GotFocus event, but there is no way to set the focus back to the dialog. The FocusPopup() method is internal. Any help is appreciated.

hfann avatar Mar 17 '22 09:03 hfann

+1, experience this too.

SDekkers avatar Sep 07 '22 12:09 SDekkers