Skip to content

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

Description

@hfann

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugevaluation requiredItems is pending review or evaluation by the team

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions