Toolkit popup accessibilty Issue using keyboard in .NET MAUI - Stack Overflow

admin2025-04-16  1

I am using the MVVM Toolkit Popup in a .NET MAUI desktop application. The popup is triggered on a button click and displays a notification message along with two buttons: "OK" and "Cancel".

I want to enable keyboard accessibility so that the Tab key can be used to navigate between the popup's buttons, and pressing Enter triggers the currently focused button's action.

However, the issue I am facing is that when the popup appears, the focus remains on the main application window instead of the popup. As a result, pressing the Tab key cycles through the controls of the main window rather than the buttons inside the popup.

I have tried manually setting focus to the popup's buttons using button1.SetFocus() after opening the popup, but the focus still remains on the main window.

additionally I tried using hidden control Entry and setting Focus on it after popup invokes.

Is there a way to ensure that when the popup appears, keyboard navigation (Tab and Enter keys) works correctly within the popup in a .NET MAUI desktop application?

  • Framwork: .NET MAUI
  • Version: .NET 8
  • CommunityToolkit.Mvvm viersion: 8.2.2
  • Platform: Windows

Here is the some code snippet snapshots SwitchCustomer.xaml ViewModel.cs

I am using the MVVM Toolkit Popup in a .NET MAUI desktop application. The popup is triggered on a button click and displays a notification message along with two buttons: "OK" and "Cancel".

I want to enable keyboard accessibility so that the Tab key can be used to navigate between the popup's buttons, and pressing Enter triggers the currently focused button's action.

However, the issue I am facing is that when the popup appears, the focus remains on the main application window instead of the popup. As a result, pressing the Tab key cycles through the controls of the main window rather than the buttons inside the popup.

I have tried manually setting focus to the popup's buttons using button1.SetFocus() after opening the popup, but the focus still remains on the main window.

additionally I tried using hidden control Entry and setting Focus on it after popup invokes.

Is there a way to ensure that when the popup appears, keyboard navigation (Tab and Enter keys) works correctly within the popup in a .NET MAUI desktop application?

  • Framwork: .NET MAUI
  • Version: .NET 8
  • CommunityToolkit.Mvvm viersion: 8.2.2
  • Platform: Windows

Here is the some code snippet snapshots SwitchCustomer.xaml ViewModel.cs

Share Improve this question asked Feb 3 at 17:04 Mahadev BansodeMahadev Bansode 1
Add a comment  | 

1 Answer 1

Reset to default 0

Setting the value CanBeDismissedByTappingOutsideOfPopup to false will cause this issue. This value indicates whether the popup can be dismissed by tapping outside of the Popup. Setting it to the true will make the keyboard navigation work.

转载请注明原文地址:http://www.anycun.com/QandA/1744759488a87217.html