You Can Leave but You Cant Come Back

The Problem

The user is part way through completing a form or wizard and then the accidently click a link or trigger back on their browser… 😞 Their progress is lost and you have a frustrated user on you hands.

A common UX pattern to solve this issue is to implement a warning before you let the user navigate away from a partially completed page. As always, you should implement this pattern cautiosly. The more the user sees this type of prompt, the less likeley they’ll read it 🙃.

Example of promting the user before they leave the page

Ember Implementation

To implement this in ember we can use an action on the active route called willTransition. This is called before the route is about to transition away and transition.abort(); will stop the trasition.

Custom Modal

The native browser confirm dialog isn’t the prettiest thing. To implement out own UI we can store the transition in the controller, show our own custom UI and then retry the transition at our users pleasure once they have confirmed.

Route

First we stop the transition, store it on the controller and show a modal to the user

Template

Out UI modal component has two actions; one to confirm the transition one to cancel it.

Controller

The modals actions are defined in our controller. On the confirm action, we call retry() on the transition to continue.

Jim Wardlaw

Developer, Designer, UX Zealot. Ember & Tailwind