-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
PushModal on Windows does not show back button #6760
Comments
@david-maw the backbutton will only show up if you nest the modal inside a NavigationPage. Which I realize isn't the most intuitive thing but that's how it currently works. Is that your issue? |
@PureWeen I don't think so but I may be misunderstanding you. It's nested inside a Shell not a NavigationPage and PushAsync is showing a backbutton while PushModalAsync is not. |
@david-maw Right, so a modal page is a space that's completely outside the space of the underlying pages. Think of it as a virtual windows. So the space inside the modal page is completely detached from a shell. So to have a back button you have to register a |
@PureWeen that's where I think I may be missing your point, when I replace the code at line 32 in
The |
Verified this issue with Visual Studio Enterprise 17.3.0 Preview 1.0 [32427.455.main]. Repro on Windows with MultiPage-windowsmodal.zip |
@david-maw why are you wanting to use a modal page here out of curiosity? So this is by design. Modal Pages have never incorporated a visual back button. For example if you run this on iOS you just get a modal View on iOS with no back button and iOS has no physical back button. Usually modals are dismissable through other means like the user has completed some action on the modal view. I could see an enhancement here where if you set "Shell.IsbackbuttonVisible" or something like that to true it would show it on modal but that's going to be an enhancement |
Thanks @PureWeen , the real App has a page which the user cannot navigate to directly from the Shell - basically it manipulates an image (it actually uses a web service to perform OCR on it) which must be selected first so it makes sense for the page to be modal because there's no other way to get to it and you must exit back from it to the more general page to act on the manipulated data (or cancel out of it). It makes no sense to navigate somewhere else until the decision (keep the OCR data or not) is made. I imagine I could produce a scheme involving turning off shell navigation while on that page which would have pretty much the same effect as far as the user is concerned and if this is just a design decision, I could certainly live with it. I didn't want to use an extra button if the back button would do the job so some sort of "Shell.IsbackbuttonVisible" type scheme would work as well. Do you want to concert this to an enhancement request, or I can submit a separate one, whatever works best? |
I'm quite confused about this as well. On Android it shows a backbutton and slides in from the bottom half way up. On Windows it replaces the entire view and you're stuck. The documentation says it's supposed to be a "popup": |
If you want to use a popup, the MAUI Community Toolkit offers this feature, which would provide the ability to overlay a view on top of other views, while still showing the content underneath. And clicking outside of the popup content can be one way to close it. https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/views/popup |
Description
Using Navigation.PushModalAsync inside a shell does not show a 'back' button on Windows (it does not need to on Android, which has a dedicated back button).
Steps to Reproduce
MultiPage-windowsmodal.zip
There are several things to note:
Shell.NavBarIsVisible="True"
in the child page XAML.Just in case it helped, I also tried:
It made no difference.
The lack of a 'back' button is a non-issue on Android which has its own dedicated back button. I'd also suggest that making the back button presence controllable with something like Shell.HasBackButton (or honoring Navigation.HasBackButton) would allow for a friendlier UI (though a back button which does nothing, controlled by Shell.BackButtonBehaviour seems arguably more like Android, for example).
Version with bug
Release Candidate 2 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows, I was not able test on other platforms
Affected platform versions
Windows 10
Did you find any workaround?
Using PushAsync instead of PushModalAsync is usually workable in the cases I've hit. but it has a problem that it also allows navigation to another shell child page (though not in this example, because there aren't any).
Relevant log output
No response
The text was updated successfully, but these errors were encountered: