Skip to content

Commit d0faebb

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 fcab7e1 commit d0faebb

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: {
@@ -223,8 +235,8 @@ module.exports = {
223235
});
224236
}
225237
parentEntry.interactiveChildCount++;
226-
} else if (isSummaryFirstChildOfDetails(node, parentEntry)) {
227-
// <summary> as first non-whitespace child of <details> is allowed
238+
} else if (isAllowedDetailsChild(node, parentEntry)) {
239+
// Non-<summary> children are body content; <summary> allowed only as first child
228240
} else if (isCompositeWidgetPattern(getRole(parentEntry.node), getRole(node))) {
229241
// Canonical ARIA composite-widget hierarchies — e.g. option inside
230242
// listbox, tab inside tablist, treeitem inside tree, row inside

0 commit comments

Comments
 (0)