avoid-nested-interactive-semantics
Warns when an interactive widget is a descendant of another interactive widget. By default checks only standard Flutter widgets.
Nesting interactive controls inside each other (e.g. an IconButton inside an InkWell card) produces conflicting accessibility nodes in VoiceOver and TalkBack.
Screen readers cannot determine which tap action target should take priority, causing screen readers to skip secondary buttons or trigger unexpected taps.
⚙️ Config
Set additional-widgets (default is empty) to add additional widgets to the list of checked widgets.
analysis_options.yaml
dcm:
rules:
- avoid-nested-interactive-semantics:
additional-widgets:
- CustomButton
- CustomSwitch
Example
❌ Bad:
// LINT: Avoid nesting interactive widgets inside each other.
// Try moving this widget out.
IconButton(child: Checkbox());
// LINT: Avoid nesting interactive widgets inside each other.
// Try moving this widget out.
Checkbox(child: IconButton());
✅ Good:
Checkbox();
IconButton();