A visible button cannot be used: check an inert ancestor
Diagnose page actions left inactive after a modal closes, inspect inert ancestors, and verify keyboard and pointer use without removing legitimate dialog behavior.
By Crawlito · 5 min read
In short
- An inert subtree can remain visible while its controls cannot be used normally.
- A modal cleanup failure can leave the main page inactive.
- Verify the dialog lifecycle and the intended action instead of only checking visual appearance.
On this page
If a page looks normal but its main button cannot be clicked or focused after a dialog closes, inspect whether an ancestor still has the inert attribute. The subtree can remain visible while normal interaction is disabled. Repair the dialog or overlay lifecycle that owns the state, then test the complete action with keyboard and pointer input.
This can affect visitors arriving from search even when the article itself is readable. It can also frustrate browser-based agents that interact with the page, without implying that every crawler uses the same interaction model.
Reproduce the exact sequence
Start from a fresh page visit and record the action before opening a dialog. Then open the modal, dismiss it through the normal control, and try the action again.
Test other supported dismissal paths, such as Escape or a route change, where the interface provides them. The defect may occur only when one cleanup path is skipped.
MDN's inert reference describes its effect on an element's subtree, including interaction and accessibility behavior. The attribute is not simply a visual hiding rule.
Record the control's label, its page region, and the steps that leave it inactive. A screenshot alone is weak evidence because the page may look identical before and after the failure.
Do not begin by increasing the button's z-index. First determine whether the problem is an overlay, a disabled control, an inert ancestor, or a failed event handler.
Inspect the control and its ancestors
In developer tools, select the affected button or link and inspect its ancestor chain for inert. Also check the control's own disabled state and whether another element covers it.
A read-only console check can identify inert elements:
[...document.querySelectorAll('[inert]')].map(element => ({
tag: element.tagName,
id: element.id,
text: element.textContent?.trim().slice(0, 80)
}));This is a diagnostic inventory, not a command to remove every attribute.
Compare the state while the dialog is open and after it closes. If the main page should be inactive only during the modal, the attribute's lifetime should match that design.
The hidden content guide addresses visibility. Keep it separate from this interaction failure: a visible element can still be unavailable for normal use.
Identify who owns the inactive state
Trace the component, dialog library, or application code that applies inert. Determine whether it uses a native modal mechanism, a library-managed attribute, or custom state.
Avoid adding a second cleanup routine before understanding the existing owner. Two systems that both toggle the same attribute can race and leave the page in the wrong state.
Inspect the close, cancel, unmount, error, and navigation paths. A dialog that disappears visually may not have completed the state transition that restores the background.
A hypothetical lifecycle record is:
Dialog opens: background becomes inactive.
Dialog closes normally: background becomes active again.
Dialog is cancelled: same restoration occurs.
Route changes: old dialog state is released.
Dialog fails to load: the page remains usable.Use the actual supported behavior of your chosen library. The goal is a coherent lifecycle, not an unconditional DOM mutation after every click.
Repair the state transition
Fix the path that leaves the attribute or equivalent modal state behind. Keep legitimate background restrictions while a modal is active.
Do not globally remove inert from the page on a timer. That can allow interaction with content that should remain outside an active dialog and can make the failure intermittent.
If the component is destroyed during navigation, use the framework or library's supported cleanup behavior. Verify that the cleanup belongs to the same state owner that applied the restriction.
Check stacked dialogs if the product supports them. Closing one should not reactivate a background that remains behind another active modal.
Keep the repair scoped to the actual action flow. A public article's checker button, an account dialog, and a payment modal may have different state owners even if they share styling.
The browser interaction audit guide provides broader context, but this incident needs a specific lifecycle reproduction and acceptance test.
Verify keyboard and pointer behavior
Repeat the original sequence after the repair. Confirm that the intended control can be reached by keyboard and activated through its normal input paths.
Then verify the actual outcome. A button receiving focus is not proof that the form submitted or the next page loaded.
Use a small matrix:
| State | Expected behavior |
|---|---|
| Before opening the dialog | Main action works |
| While the modal is active | Intended modal interaction |
| After normal close | Main action restored |
| After cancellation or navigation | No stale inactive background |
| Failed dialog load | Defined recovery path |
Test on the supported mobile layout as well. A separate mobile dialog component can retain the same defect even when desktop passes.
Avoid using developer tools to manually remove inert as the final verification. That can confirm the cause, but only the repaired application flow proves the fix.
Separate action readiness from crawl access
A plain HTTP fetch may contain all the article text and still say nothing about whether a visitor can complete the next step. Keep content access and interaction evidence distinct.
A browser-based agent may also be affected by inactive controls, but do not claim that every AI service uses the accessibility tree or simulates the same input. Report the observed interface behavior.
The conversion measurement guide helps define the completed outcome. A click count or dialog-close event should not stand in for a successful check or inquiry.
If analytics show many starts but few completions after a modal change, reproduce the flow before concluding that the content attracted the wrong audience.
Technical content can bring the right visitor to the page; the next action still needs to work. That is why a focused interaction test belongs beside public readability checks.
Prevent the defect in future modal changes
Keep the failing close path as a regression example. It should exercise the user journey and successful action, not merely assert that a specific attribute is absent.
Review the lifecycle when changing dialog libraries, route transitions, or conditional rendering. Those changes can alter cleanup without changing the visual design.
Document which component owns background inactivity. This prevents a later feature from adding a second independent toggle.
For an agency report, include the before and after sequence, the affected control, and the successful outcome. A static screenshot cannot capture the difference.
Also retain a control test while the modal is open. A repair that restores the background too early is not complete even if the original button now works after closing.
Add a test where the visitor closes the overlay and immediately follows a different navigation path. Inspect the new page's ancestors as well as the original page. This can expose cleanup that depends on a component remaining mounted long enough to run.
Keep a short expected-focus note with the test: where focus begins, where it moves when the dialog opens, and where the reader can continue after closing it. That note helps distinguish a control that remains inert from a control that is active but difficult to reach because focus was restored incorrectly.
Frequently asked questions
Does inert mean the element is visually hidden?
No. A subtree can remain visible while interaction and accessibility behavior change.
Should I delete all inert attributes?
No. Preserve intentional modal behavior and repair the state that remains after it should end.
Can a public page checker prove the form works?
Not by a fetch alone. Pair technical page inspection with a real interaction test and accepted outcome.
Use the free Crawlito check for the page's public technical state, then verify its next-step action through the repaired flow.
Filed under Rendering and content. Topics: html, accessibility, javascript