Skip to content

Commit 2fec9f7

Browse files
authored
Merge pull request #522 from n-chardon/n-chardon-fix-issue510
Fix documentation #510
2 parents a2f2c54 + 4758cbf commit 2fec9f7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/rules/no-static-element-interactions.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@ Note: Adding a role to your element does **not** add behavior. When a semantic H
4040

4141
### Case: The event handler is only being used to capture bubbled events
4242

43-
If a static element has an event handler for the sole purpose of capturing events from its descendants, you can tell the linter to ignore it by setting `role="presentation"`:
43+
If your element is catching bubbled click or key events from descendant elements, there are no appropriate roles for your element: you will have to deactivate the rule. Consider explaining the reason for disabling the rule as well.
4444

4545
```jsx
46-
<div
47-
onClick={this.handleButtonClick}
48-
role="presentation">
46+
{/* The <div> element has a child <button> element that allows keyboard interaction */}
47+
{/* eslint-disable-next-line no-static-element-interactions */}
48+
<div onClick={this.handleButtonClick}>
4949
<button>Save</button>
5050
<button>Cancel</button>
5151
</div>
5252
```
5353

54-
This `role` has no effect on static elements, but it clarifies your intent.
54+
Do not use the role `presentation` on the element: it removes the element's semantics, and may also remove its children's semantics, creating big issues with assistive technology.
5555

5656
### References
5757

0 commit comments

Comments
 (0)