Taoffi's blog

prisonniers du temps

Xamarin forms: Don’t do modal (useless)

 

A vestige of old desktop applications UI is what is called: Modal Dialogs.

By 'Modal' we meant a 'sans-issue' place. A place where I put my user in a situation where he or she cannot go further before providing an information!

An investigation cell / A Quarantine / A Guantanamo Bay in some ways. Where I (the app developer or architect) feel secure and menacing (while pretending doing this for the end user's benefit!)… Did you say schizophrenia? :)

 

In those old days, that was an easy way for a developer to ensure the integrity of a workflow for certain key steps.

Was that wrong? Surely Yes. But lacking the means to construct an acceptable workflow integrity mechanism that can now be excusable (or forgiven).

I mean: if a workflow step may execute while it requires a previous validation that did not complete. That is entirely imputable to the application and cannot be the end user's fault.

If accessing a bank account page requires login, it is the bank account page responsibility to check if there is someone logged-in and authorized to view it (Whether we displayed a Login page or not). The fact that the Login page can be 'modal' may have a simple symbolic meaning, but at a functional level there is no sense to keep the user locked on this page or prevent him or her from doing something else (let only: cancelling!).

 

With the time going, this 'modal' vestige has proved more and more ineffective and often ridiculous. In an Internet app for instance, you cannot lock me on a modal page. I may navigate somewhere else… duplicate the navigator's tab… open another navigator, or close all and go for a beer!

In the mobile apps world that has even less sense. A mobile developer who might like these 'modal' patterns would find himself in a real battle against windmills.

 

Xamarin Forms supply a Navigation.PushModal / PopModal. But that has little sense though. Currently, the 'modal' pattern is not (at all) effective on Win Phone. In iOS, using modals often generates weird navigation situations and errors (many questions about this subject on various forums since 2014… without a final or accurate answer). In Android, modal navigation works nearly as expected, except that the OS (or the device) provides a 'back' button that allows anyone to easily exit the 'modal' prison we created for him or her!

 

So if you don't want to lose your time building strange and useless fences to keep your users in 'modal' prison cells, please don't use those Modal Push / Pop. Keep the navigation 'natural' as it is proposed by the OS. And invest more time for ensuring each step has its self-integrity mechanisms. That is a more reasonable approach.

 

Finally, we sometimes confuse 'modal' and 'full-screen' page. If you need your page to be full-screen (without the top navigation bar) that is quite easy in Xamarin Forms. Just insert this in your navigation page's constructor:

NavigationPage.SetHasNavigationBar(this, false);

Comments are closed