Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Choose HTML elements for their semantic meaning, not by habit
Choose elements whose semantic purpose and allowed child content match the UI. Check implicit accessibility roles as well as styling before replacing a neutral container.
Bad example
| 1 | <output><div><p>Explore our new collection</p></div></output> |
Explanation (EN)
A promotional container is not a calculation result, and its block children do not fit the output content model.
Objašnjenje (HR)
Promotivni spremnik nije rezultat izračuna, a njegovi blokovski elementi ne odgovaraju dopuštenom sadržaju output elementa.
Good example
| 1 | <div><p>Explore our new collection</p></div> |
Explanation (EN)
A neutral container avoids unintended meaning. Add a live-region role only when the interaction requires an announcement.
Objašnjenje (HR)
Neutralan spremnik izbjegava nenamjerno značenje. Ulogu za najavu uživo dodaj samo kad je potrebna za interakciju.
Notes (EN)
Apply when choosing or changing root markup. Validate the element content model, landmark meaning and implicit accessibility behavior. A lint preference for a native element does not override valid nesting or intended semantics. Native status elements and div role=status can both announce updates, so changing the tag alone does not remove live-region behavior.
Bilješke (HR)
Primijeni pri izboru ili promjeni korijenskog elementa. Provjeri dopušteni sadržaj, značenje orijentira i implicitno ponašanje pristupačnosti. Lint pravilo koje daje prednost izvornom elementu ne nadjačava valjano ugnježđivanje ni namjeravanu semantiku. Izvorni statusni elementi i div s role=status mogu najavljivati promjene, pa sama promjena oznake ne uklanja to ponašanje.
Exceptions / Tradeoffs (EN)
Use semantic elements when the content actually satisfies their purpose and structure. A deliberate status message may need role=status on a valid container. Do not remove useful semantics merely to silence a validator.
Iznimke / Tradeoffi (HR)
Koristi semantičke elemente kad sadržaj odgovara njihovoj namjeni i strukturi. Namjerna statusna poruka može trebati role=status na valjanom spremniku. Nemoj uklanjati korisnu semantiku samo radi utišavanja validatora.