Modal
Focus with Clarity: Your Gateway to Streamlined Interactions With Modal
Last updated
Focus with Clarity: Your Gateway to Streamlined Interactions With Modal
Last updated
The Modal Component is a dynamic UI element designed to capture user attention by overlaying the main content. It facilitates focused interactions, such as completing tasks or entering information, by temporarily pausing interaction with the background content. This component is essential for guiding users through specific processes without distractions, making it a cornerstone of effective user interface design.
The anatomy of a Modal Component typically includes a backdrop that dims the underlying content, a central window that displays the primary content or form, a close button to exit the modal, and may also feature headers and footers for additional information or actions. This structured layout focuses the user's attention on the task at hand.
The Modal Component is designed with two distinct sizing properties to ensure flexibility and adaptability in various UI contexts:
Size | Modal Size |
---|---|
Small | XSmall |
Medium | Small |
Large | Medium |
Large | |
Small: Optimized for minimal content or compact displays.
Medium: Balances detail and space, suitable for most use cases.
Large: Provides ample space for complex content or detailed interactions.
XSmall: Extremely compact, focusing on the most critical content.
Small: Slightly larger, offering a bit more space while remaining unobtrusive.
Medium: A versatile size that accommodates a wide range of content without overwhelming the screen.
Large: Maximizes space for extensive information, complex forms, or interactive content.
The layout and spacing within the Modal Component are crucial for readability and user comfort. Adequate spacing between elements within the modal, as well as between the modal and the edges of the screen, ensures that the content is easy to interact with, without overwhelming the user.
The Modal Component is designed to seamlessly integrate with both light and dark mode preferences, adapting its color scheme to match the user’s or system's settings. This ensures a consistent and strain-free viewing experience regardless of the ambient lighting conditions or user preferences.
Accessibility features in the Modal Component are paramount, including keyboard navigation for interacting with the modal (such as tabbing through form fields), screen reader support to announce the modal's presence and content, and ARIA roles and properties to denote the modal's status and function. These features ensure that all users, regardless of their abilities, can interact with the modal effectively.
Criteria | Description | Status |
---|---|---|
ARIA Attributes | Ensures ARIA attributes are allowed for an element's role | ✔️ Passed |
ARIA Hidden Elements | Ensures aria-hidden elements are not focusable nor contain focusable elements | ✔️ Passed |
ARIA Valid Values | Ensures all ARIA attributes have valid values | ✔️ Passed |
ARIA Valid Names | Ensures attributes that begin with aria- are valid ARIA attributes | ✔️ Passed |
Discernible Text | Ensures buttons have discernible text | ✔️ Passed |
Nested Interactive Controls | Ensures interactive controls are not nested as they are not always announced by screen readers or can cause focus problems for assistive technologies | ✔️ Passed |
Tabindex Attribute | Ensures tabindex attribute values are not greater than 0 | ✔️ Passed |
ID Attributes | Ensures every id attribute value is unique | ✔️ Passed |
Color Contrast | Ensures the contrast between foreground and background colors meets WCAG 2 AA contrast ratio thresholds | ✔️ AA ~ AAA |
Property | Description | Type | Accepted Values | Default |
---|---|---|---|---|
size | Determines the size of the modal | String |
|
|
is-open | Indicates if the modal is open or closed | Boolean |
|
|
Method | Description |
---|---|
show | Opens the modal |
hide | Closes the modal |
Event | Description |
---|---|
plus-modal-before-show | Triggered before the modal is opened |
plus-modal-show | Triggered when the modal is opened |
plus-modal-before-hide | Triggered before the modal is closed |
plus-modal-hide | Triggered when the modal is closed |