In this Article
What are Interactive Controls?
Interactive controls refer to the situation in which an interactive element (such as a button, link, or input field) is placed inside another interactive element.
Interactive controls are user interface elements that allow users to interact with a webpage. These controls allow users to, among other things, input information, make selections, and execute commands. They are essential for creating engaging and user-friendly experiences.
Examples of Interactive Controls:
Buttons (
<button>
)Links (
<a>
)Inputs (
<input>
,<textarea>
, etc.)Select dropdowns (
<select>
)Clickable elements with
tabindex
orrole="button"
Why must Interactive Controls not be nested?
Nesting interactive controls can lead to accessibility, usability, and functionality issues for both users and assistive technologies.
Some issues that may arise from nesting interactive controls:
Screen readers might skip announcing nested elements, leading to an empty tab stop. This can pose challenges for users with motor impairments, which can impact the user's experience.
Assistive technologies, like screen readers, often have difficulty interpreting nested controls. They may not convey the correct hierarchy or purpose of the elements, confusing users with disabilities.
Nested controls can create unpredictable focus behavior when users navigate using keyboards or screen readers, making it hard to access or activate specific elements.
When interactive controls are nested, user interactions (like clicks or taps) might trigger both the parent and child controls unintentionally.
Nesting of certain interactive elements, like buttons inside other buttons, violates semantic HTML rules. Therefore, browsers may not handle nesting consistently, leading to rendering or functionality issues.
How to Avoid Nesting Interactive Controls
Use Wrapper Elements: Instead of nesting, wrap interactive controls in non-interactive container elements (e.g.,
<div>
or<span>
) to group them visually.Separate Functions: Ensure each control is self-contained and handles only its specific function.
Use ARIA Roles: If complex interactions are necessary, use ARIA attributes to explicitly define relationships between elements without nesting.
Learn More with WCAG
DubBot Flag: Interactive controls must not be nested, Ensures interactive controls are not nested as they are not always announced by screen readers or can cause focus problems for assistive technologies
If you have questions, please contact our DubBot Support team via email at help@dubbot.com or via the blue chat bubble in the lower right corner of your screen. We are here to help!