-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Labels
area-controls-modalarea-keyboardKeyboard, soft keyboardKeyboard, soft keyboardplatform/iosplatform/windowss/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/a11yRelates to accessibilityRelates to accessibilityt/bugSomething isn't workingSomething isn't working
Milestone
Description
Description
On Windows in .NET MAUI 8.0 and 9.0 Preview 4, the keyboard focus does not shift to the newly opened modal page (opened using Navigation.PushModalAsync), but remains on the main page (first page of the app). You can press enter to click the button on the page beneath the modal page.
Steps to Reproduce
- Make the default MAUI app
- Create a new MAUI ContentPage named ModalTestPage.
- Change ModalTestPage's background color to Beige by adding to the page's XAML:
BackgroundColor="Beige". - Add the following code to the MainPage button:
var modalPage = new ModalTestPage();
Navigation.PushModalAsync(modalPage);
- (This is from other example of having a problem with maximizing, but I keep it here just in case it is relevant.) Add to the top of MauiProgram.cs the following:
using Microsoft.Maui.LifecycleEvents;
and add to builder the following:
#if WINDOWS
.ConfigureLifecycleEvents(events =>
{
// Make sure to add "using Microsoft.Maui.LifecycleEvents;" in the top of the file
events.AddWindows(windowsLifecycleBuilder =>
{
windowsLifecycleBuilder.OnWindowCreated(window =>
{
window.ExtendsContentIntoTitleBar = false;
var handle = WinRT.Interop.WindowNative.GetWindowHandle(window);
var id = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(handle);
var appWindow = Microsoft.UI.Windowing.AppWindow.GetFromWindowId(id);
switch (appWindow.Presenter)
{
case Microsoft.UI.Windowing.OverlappedPresenter overlappedPresenter:
overlappedPresenter.SetBorderAndTitleBar(false, false);
overlappedPresenter.Maximize();
break;
}
});
});
})
#endif
- Add a tap recognizer to the label on ModalTestPage:
XAML:
<Label
Text="Welcome to .NET MAUI!"
VerticalOptions="Center"
HorizontalOptions="Center">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"></TapGestureRecognizer>
</Label.GestureRecognizers>
</Label>
C#: (closes the modal window, so you can check what's going on beneath):
private void TapGestureRecognizer_Tapped(object sender, TappedEventArgs e)
{
Navigation.PopModalAsync();
}
- Build and start the app.
- Press the button. A modal page opens. (Note that the modal page (beige) does not cover the whole window, but this is not relevant in this example.)
- Press enter key on your keyboard 10 times. This in fact presses the button on MainPage beneath.
- Click the "Welcome to .NET MAUI!" label 11 times (11 modal pages have appeared).
- The button says it has been clicked 11 times.
Link to public reproduction project repository
Can make one if need be, but this is very easy to replicate.
Version with bug
9.0.0-preview.4.10690
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Windows 11
Did you find any workaround?
No. All potential workarounds are complicated and imperfect.
Relevant log output
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-controls-modalarea-keyboardKeyboard, soft keyboardKeyboard, soft keyboardplatform/iosplatform/windowss/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/a11yRelates to accessibilityRelates to accessibilityt/bugSomething isn't workingSomething isn't working