VIEW020: dom-and-action-click
Button has both dom.onClick and component.onActionPerformed actions
| Code | VIEW020 |
| Name | dom-and-action-click |
| Category | View structure (VIEW) |
| Default severity | warning |
| Enabled by default | yes |
| Fix available | no |
| ign-lint equivalent | none |
What it does
Section titled “What it does”Reports a Button (ia.input.button) that has enabled actions on both
events.dom.onClick and events.component.onActionPerformed.
Why is this bad?
Section titled “Why is this bad?”A mouse click on a button fires both events, so the work runs twice (two
writes, two popups, two navigations), in an order that is not guaranteed.
onActionPerformed also fires for keyboard activation, so it is the one to
keep.
Example
Section titled “Example”"events": { "dom": {"onClick": {"type": "script", "scope": "G", "config": {"script": "\tsave()"}}}, "component": {"onActionPerformed": {"type": "script", "scope": "G", "config": {"script": "\tsave()"}}}}Use instead:
"events": { "component": {"onActionPerformed": {"type": "script", "scope": "G", "config": {"script": "\tsave()"}}}}Generated from the rule metadata by iglint generate-docs; iglint rule VIEW020 prints the same page in the terminal. Source: docs/rules/VIEW020.md.