0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-30 11:10:43 +01:00
wagtail/docs/contributing/html_guidelines.rst
Thibaud Colas d58c90db5d
Update accessibility contribution guidance in bug report and PR templates (#7142)
Co-authored-by: Scott Cranfill <scott@scottcranfill.com>
2021-05-11 16:57:29 +01:00

19 lines
911 B
ReStructuredText

HTML coding guidelines
======================
We use `Django templates <https://docs.djangoproject.com/en/stable/ref/templates/language/>`_ to author HTML.
Linting HTML
~~~~~~~~~~~~
We use `jinjalint <https://github.com/motet-a/jinjalint>`_ to lint templates. If you have installed Wagtail's testing dependencies (``pip install -e .[testing]``), you can check your code by running ``make lint``.
Principles
~~~~~~~~~~
* Write `valid HTML <https://validator.w3.org/nu/>`_. We target the HTML5 doctype.
* Write `semantic HTML <https://html5doctor.com/element-index/>`_.
* Consult `ARIA Authoring Practices <https://w3c.github.io/aria-practices/>`_, in particular `No ARIA is better than Bad ARIA <https://w3c.github.io/aria-practices/#no_aria_better_bad_aria>`_.
* Attach JavaScript behavior with ``data-`` attributes, rather than classes or IDs.
* For comments, use Django templates syntax instead of HTML.