Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP1universalStack: HTML/React
htmlaccessibilityformscorrectness
Always set an explicit type on <button>
A button without a type defaults to submit and can unexpectedly submit a surrounding form. Set type="button" (or submit/reset) explicitly.
PR: hegnar-components · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetsx
| 1 | <button onClick={handleClick}> |
| 2 | <Icon /> |
| 3 | </button> |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | <button type="button" onClick={handleClick} aria-label="Play"> |
| 2 | <Icon /> |
| 3 | </button> |
Explanation (EN)
Objašnjenje (HR)