<?xml version="1.0" encoding="utf-8"?>

Modals are windows that appear on top of a parent screen. They are also called modal dialogs or overlays. The term "modal" comes from the fact that it creates a mode that disables the parent screen but keeps it visible. Users must interact with the modal dialog to return to the main screen.

Modal dialogs can be an elegant solution to a UI problem. They simplify the UI, save screen space and instantly grab users' attention. At the same time, overusing modal dialogs can annoy users. So, knowing when to use them and how can come in handy.

Exercise #1

Modals vs non-modals

Modals vs non-modals

When modal dialogs pop up, they require user interaction before users can continue using the rest of the application. In other words, they block interaction with the rest of the application until the dialog is dismissed.

Non-modal dialogs (also called modeless), on the other hand, do not block interaction with the rest of the application. They can easily be ignored or minimized by users and do not cause any disruption to their tasks.

Exercise #2

Use modals for confirming destructive actions

Use modals for confirming destructive actions

Modals excel at grabbing attention, making them effective for alerting and confirming destructive actions. When users are about to take steps that can't be undone—like deleting an account or important files—a modal serves as a final checkpoint. It isolates the decision, removing distractions and prompting users to pause and think.

The modal ensures the action is intentional, offering a last chance to cancel. It can also provide crucial information, such as the number of files to be deleted, so users understand the impact of their decision. By concentrating focus on the action at hand, modals minimize the risk of accidental or uninformed choices.

Exercise #3

Use modals for collecting information

Use modals for collecting information Bad Practice
Use modals for collecting information Best Practice

Modals excel at collecting vital information for tasks that demand immediate user focus. They create a dedicated space that isolates the user from the main content, ensuring that attention is given to the critical task at hand. For example, if users are completing a financial transaction, a modal could be employed to collect payment details securely. This scenario benefits from the heightened focus that a modal offers.

However, it's good practice to consider alternative, less disruptive elements like inline forms for tasks that don't require immediate user attention. When used thoughtfully, modals can make the process of gathering important information more efficient and focused.

Exercise #4

Use modals for displaying critical information

Use modals for displaying critical information Bad Practice
Use modals for displaying critical information Best Practice

Modals excel at grabbing attention, making them ideal for displaying critical information that requires immediate user focus. By overlaying the main content and often dimming the background, modals effectively signal to users that something important is happening. This ensures that the critical message, like an urgent system update or security alert, is not easily overlooked. Moreover, modals usually require an action to dismiss, ensuring that the message has been acknowledged before users can proceed.

However, it's crucial to use this attention-grabbing tool sparingly to avoid annoying users or diluting the impact of truly critical messages. The key is balancing the urgency of the information with the user's ongoing experience.

Exercise #6

Fullscreen desktop modal

Fullscreen desktop modal

Fullscreen desktop modals command the entire screen, focusing users' attention on crucial tasks or information. Much like popup modals, they block out underlying content until users take action. Often resembling a new page, these modals are typically used for tasks like logging in, registering an account, showing terms and conditions, or delivering feedback and error messages. They can also handle more complex activities like processing payments or guiding users through multi-step forms.

While effective in grabbing attention and minimizing distractions, these modals must be used judiciously. Overuse can disrupt the user experience, causing more annoyance than engagement.

Exercise #7

Fullscreen mobile modal

Fullscreen mobile modal

Fullscreen mobile modals function like their desktop equivalents, serving as pop-up windows that overlay existing content. Tailored for smaller mobile screens, these modals are used to spotlight key or urgent information that demands immediate user focus.

Making these modals easy to dismiss is crucial. Users can get frustrated if they can't quickly exit the modal to return to the main content. It's all about striking a balance between capturing attention and allowing for smooth navigation.

Exercise #8

Popover modal

Popover modal

Popovers are small overlay windows that show up when users interact with specific areas on a website or app. Unlike popup modals that block the main content, popovers let users stay engaged with the primary interface. They pop up as a petite floating window and can be dismissed easily.

These mini-windows are activated by actions like hovering, clicking, or touch gestures. They're handy for sharing extra product details, offering customization options, or suggesting a next step. Popovers shine in situations where users need a bit more info or guidance without being pulled away from what they're doing. So, they offer a balance between enlightening the user and maintaining workflow.[1]

Pro Tip: Avoid using popovers to display vital information since they can be easily overlooked.

Exercise #10

Position modals in the center

Position modals in the center  Bad Practice
Position modals in the center  Best Practice

Centering modals that aren't fullscreen is generally the most effective approach. On mobile, aligning modals both vertically and horizontally in the center helps them pop, making it clear that they demand user attention. For desktops, while it's still good to center the modal horizontally, you might want to position it slightly toward the top.

This isn't just about aesthetics; it also ensures that the modal stays put even if the browser window gets resized. Keeping the modal stable contributes to a seamless user experience, reducing any possible friction or confusion.

Pro Tip: This rule does not apply to popovers — they are better off being displayed close to the interactive elements that trigger them.

Exercise #11

iOS vs. Android modals

iOS vs. Android modals Bad Practice
iOS vs. Android modals Best Practice

Designing mobile modals involves understanding nuances between Android and iOS, but the core best practices remain similar across platforms.

In Android, these are known as dialogs, featuring optional titles, content, and buttons. Roboto is the preferred typeface, and button labels are usually all caps. Solid dividers between buttons are avoided.[2]

On iOS, they're called alerts. They have a title, optional content, and buttons, using the San Francisco typeface. The primary button is slightly bolder, and dividers separate content and buttons.[3]

Understanding these subtle differences helps designers create modals that are both effective and consistent, no matter the operating system.

Exercise #12

iOS vs. Android bottom sheets

iOS vs. Android bottom sheets

Both Android and iOS offer "bottom sheets," but with slight variations. Android's bottom sheet pops up to display either a list of actions or shareable apps, activated by tapping a button or overflow icon. iOS calls it an "action sheet," presenting a list of actions that slide in from the bottom. Android uses this feature for supplementary content, while iOS aims to provide a set of related but optional tasks.[4]

Though the names differ, the core function is similar: providing users with an unobtrusive way to access more options without disrupting the current app context. Both are handy tools in mobile design where screen space is precious.

Complete this lesson and move one step closer to your course certificate