Modal
A modal is a user interface element that creates a temporary, focused layer on top of the main content, requiring user interaction before returning to the underlying page. It is commonly used for alerts, confirmations, forms, or additional information without navigating away. Modals block interaction with the background to direct attention to a specific task or message.
Developers should use modals when they need to capture user input, display critical information, or confirm actions without disrupting the main workflow, such as for login forms, error messages, or data deletion confirmations. They are essential in web and mobile applications to improve user experience by keeping users in context while handling secondary tasks, but should be used sparingly to avoid accessibility issues or user frustration.