Skip to content

Commit aa055cd

Browse files
authored
fix(lint/a11y/noStaticElementInteractions): exclude custom elements (#10191)
1 parent 0cf1458 commit aa055cd

4 files changed

Lines changed: 9 additions & 2 deletions

File tree

.changeset/proud-trams-feel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@biomejs/biome": patch
3+
---
4+
5+
Now the rule [`noStaticElementInteractions`](https://biomejs.dev/linter/rules/no-static-element-interactions/) doesn't trigger custom elements.

crates/biome_js_analyze/src/lint/a11y/no_static_element_interactions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ impl Rule for NoStaticElementInteractions {
101101
fn run(ctx: &RuleContext<Self>) -> Self::Signals {
102102
let node = ctx.query();
103103

104-
// Custom components are not checked because we do not know what DOM will be used.
105-
if node.is_custom_component() {
104+
// Custom components and elements are not checked because we do not know what DOM will be used.
105+
if node.is_custom_component() || node.is_custom_element() {
106106
return None;
107107
}
108108

crates/biome_js_analyze/tests/specs/a11y/noStaticElementInteractions/valid.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<Button onClick={doFoo} />
55
<Button onClick={doFoo} />
66
<div />
7+
<custom-element onClick={doFoo} />
78
<div className="foo" />
89
<div className="foo" {...props} />
910
<div onClick={() => void 0} aria-hidden />

crates/biome_js_analyze/tests/specs/a11y/noStaticElementInteractions/valid.jsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ expression: valid.jsx
1010
<Button onClick={doFoo} />
1111
<Button onClick={doFoo} />
1212
<div />
13+
<custom-element onClick={doFoo} />
1314
<div className="foo" />
1415
<div className="foo" {...props} />
1516
<div onClick={() => void 0} aria-hidden />

0 commit comments

Comments
 (0)