Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContentDialog without Buttons lets focus shift to background and interact with background #10139

Closed
dbirler opened this issue Nov 5, 2024 · 3 comments
Labels
bug Something isn't working needs-triage Issue needs to be triaged by the area owners

Comments

@dbirler
Copy link

dbirler commented Nov 5, 2024

Describe the bug

I would have expected that if a ContentDialog is shown, no interaction with anything in the background is possible. But this is not what's currently happening. To me it seems that when the ContentDialog has no control that the user can interact with, the focus can "escape" to the background and interact with the controls that are supposed to be "disabled".

To me this is a severe issue, as i use ContentDialog as progress message dialogs and during their showtime the user is not supposed to interact with anything that is in the background of the dialog.

Sample to reproduce: TestContentDialog.zip

Steps to reproduce the bug

  1. Launch the test app
  2. Click Button "Click Me"
  3. Press [TAB] and watch focus shift to "Button1"
  4. Press [SPACEBAR] and watch content of "Button1" changing

Expected behavior

No interaction with anything but the ContentDialog is possible while the ContentDialog is open.

Screenshots

TestContentDialog.mp4

NuGet package version

WinUI 3 - Windows App SDK 1.6.1: 1.6.240923002

Windows version

Windows 10 (21H2): Build 19044

Additional context

No response

@dbirler dbirler added the bug Something isn't working label Nov 5, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Nov 5, 2024
Copy link

github-actions bot commented Nov 5, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@dbirler
Copy link
Author

dbirler commented Nov 5, 2024

Workaround is to put IsTabStop = true on a control in the ContentDialog like this:

public sealed partial class MainWindow : Window
{
  ContentDialog contentDialog = null;

  public MainWindow()
  {
    this.InitializeComponent();
  }

  private async void myButton_Click(object sender, RoutedEventArgs e)
  {
    myButton.Content = "Clicked";

    TextBlock textBlock = new TextBlock() { Text = "Hello World!", IsTabStop = true };
    textBlock.Tapped += TextBlock_Tapped;

    contentDialog = new ContentDialog();
    contentDialog.Title = "Test";
    contentDialog.Content = textBlock;
    contentDialog.XamlRoot = this.Content.XamlRoot;

    await contentDialog.ShowAsync();
  }

  private void TextBlock_Tapped(object sender, TappedRoutedEventArgs e)
  {
    contentDialog.Hide();
  }

  private void button1_Click(object sender, RoutedEventArgs e)
  {
    button1.Content = "Button 1 Clicked";
  }

  private void button2_Click(object sender, RoutedEventArgs e)
  {
    button2.Content = "Button 2 Clicked";
  }
}

@dbirler
Copy link
Author

dbirler commented Nov 5, 2024

Closing this as it is possibly a duplicate of #5739 but this should really be investigated and fixed at the framework level, as imho this is a critical bug.

@dbirler dbirler closed this as completed Nov 5, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added needs-triage Issue needs to be triaged by the area owners and removed needs-triage Issue needs to be triaged by the area owners labels Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage Issue needs to be triaged by the area owners
Projects
None yet
Development

No branches or pull requests

1 participant