A nested-interactive error means axe found a focusable element inside a control whose descendants are expected to be presentational. A common example is a card with role="button" that contains a details link. Fix the card by giving the link and button their own places in the markup. Then use Tab, Enter, and Space to check that each does its own job.
What the nested-interactive rule checks
Some controls, including buttons, expose their contents as part of the control's label rather than as independent controls. A focusable child can receive keyboard focus without a screen reader announcing its name, role, or state as expected. Deque's nested-interactive rule documentation explains the resulting empty tab stop.
The HTML content rules also apply when axe reports no violation. A link with an href cannot contain a button, another anchor, or a descendant with tabindex. A button has its own restriction on interactive descendants and descendants with tabindex. Check the HTML rules for anchors and the HTML rules for buttons.
Find the outer control in the rendered DOM
Open the route and state in which the audit found the issue. If it appears only in compact cards or after results load, reproduce that state first. Use the axe target to find the outer control in DevTools. Expand its descendants and look for a link, button, input, or element with tabindex. Check the computed role too. A plain-looking div may get role="button" from a reusable component.
For example, this card presents itself as a Save button while also containing a link to the project.
<div class="project-card" role="button" tabindex="0"
aria-label="Save Cedar Studio">
<h2><a href="/projects/cedar">Cedar Studio</a></h2>
<p>Portfolio template</p>
<span>Save</span>
</div>
Inspect the live DOM even when you have the template open. When the HTML parser encounters a second button start tag while the first button is still in scope, it closes the first before inserting the second. This can change which node wraps the visible content. See the HTML parsing rules for the body.
Fix a card with a link and a button
Give the project name a native link and make Save a native button. Let the surrounding card handle layout. Keep the visible Save text in the button's accessible name and include the project name so repeated Save buttons are distinguishable.
<article class="project-card">
<h2><a href="/projects/cedar">Cedar Studio</a></h2>
<p>Portfolio template</p>
<button type="button" aria-label="Save Cedar Studio"
aria-pressed="false">
Save
</button>
</article>
Bind the app's save action to the button. For a toggle, update aria-pressed to reflect the saved state and keep the label stable. Remove the card's old click and keyboard handlers so activating the button cannot also navigate. See the WAI button pattern and the guide to accessible names.
If the card has a single destination, use one link and style it to match the design. If the entire surface must be clickable and the card also has a secondary button, keep the controls separate in the DOM and use CSS to expand the link's pointer area. Test that the overlay leaves the secondary button clickable, the focus indicator visible, and text selection usable. The website CTA checklist covers checking labels and destinations.
Changing tabindex or adding stopPropagation() leaves the nested markup in place. Use layout to preserve the visual grouping after moving the controls.
Verify the repair with axe and Playwright
First tab from the project link to the Save button, then use Shift+Tab to go back. Press Space on Save and confirm that it toggles without navigating. Return to the link, press Enter, and confirm that the project opens. Repeat at a narrow viewport if the card has a different layout there. Listen with a screen reader for the separate link and button names and the button's pressed state. Use the keyboard accessibility testing checklist to extend that pass to other components.
The Playwright example assumes @axe-core/playwright is installed, the test configuration sets baseURL, and /projects shows the repaired card with a fresh, unsaved project. It checks the axe rule and the keyboard behavior separately. Playwright documents how to integrate axe.
import AxeBuilder from '@axe-core/playwright';
import { expect, test } from '@playwright/test';
test('project link and Save work independently', async ({ page }) => {
await page.goto('/projects');
const project = page.getByRole('link', {
name: 'Cedar Studio',
exact: true,
});
const save = page.getByRole('button', {
name: 'Save Cedar Studio',
exact: true,
});
await expect(save).toHaveAttribute('aria-pressed', 'false');
const results = await new AxeBuilder({ page })
.withRules(['nested-interactive'])
.analyze();
expect(results.violations).toEqual([]);
const listingUrl = page.url();
await project.focus();
await page.keyboard.press('Tab');
await expect(save).toBeFocused();
await page.keyboard.press('Space');
await expect(save).toHaveAttribute('aria-pressed', 'true');
await expect(page).toHaveURL(listingUrl);
await page.keyboard.press('Shift+Tab');
await expect(project).toBeFocused();
await page.keyboard.press('Enter');
await expect(page).toHaveURL(/\/projects\/cedar$/);
});
A rule-only run checks the rendered state in the test. If a menu or response reveals additional controls, open that state before analyzing it. Keep the focused test alongside your broader website regression checks.
Check the deployed route with Slop Audit
Run a Slop Audit on the public listing URL and open Accessibility violations. When the rendered axe pass reports nested-interactive, use the reported selectors to find the parent control in the deployed DOM. Rescan the same URL after deploying the fix, then repeat the keyboard and screen-reader checks in any state that requires interaction.