Skip to content

Commit 59b93ec

Browse files
committed
fix(template-no-nested-interactive): allow interactive content in <details> body panel
During the rebase that introduced isSummaryFirstChildOfDetails, the broader isAllowedDetailsChild check was lost. The disclosed panel of <details> is flow content — interactive children after <summary> are valid and must not be flagged. Restores isAllowedDetailsChild as a wrapper that delegates the <summary>-position check to isSummaryFirstChildOfDetails.
1 parent b7cfff0 commit 59b93ec

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

lib/rules/template-no-nested-interactive.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ function isSummaryFirstChildOfDetails(summaryNode, parentEntry) {
6565
return firstNonWhitespace === summaryNode;
6666
}
6767

68+
function isAllowedDetailsChild(childNode, parentEntry) {
69+
if (parentEntry.tag !== 'details') {
70+
return false;
71+
}
72+
// Non-<summary> children are flow content in the disclosed panel — allowed.
73+
if (childNode.tag !== 'summary') {
74+
return true;
75+
}
76+
// <summary> is only allowed as the first non-whitespace child of <details>.
77+
return isSummaryFirstChildOfDetails(childNode, parentEntry);
78+
}
79+
6880
/** @type {import('eslint').Rule.RuleModule} */
6981
module.exports = {
7082
meta: {
@@ -213,8 +225,8 @@ module.exports = {
213225
});
214226
}
215227
parentEntry.interactiveChildCount++;
216-
} else if (isSummaryFirstChildOfDetails(node, parentEntry)) {
217-
// <summary> as first non-whitespace child of <details> is allowed
228+
} else if (isAllowedDetailsChild(node, parentEntry)) {
229+
// Non-<summary> children are body content; <summary> allowed only as first child
218230
} else if (isCompositeWidgetPattern(getRole(parentEntry.node), getRole(node))) {
219231
// Canonical ARIA composite-widget hierarchies — e.g. option inside
220232
// listbox, tab inside tablist, treeitem inside tree, row inside

0 commit comments

Comments
 (0)