{% load helpers %} {% comment %} These containers are rendered on every page and are targets that HTMX appends new messages into (see `messages.js`, which swaps with `beforeend`, and the `hx-select-oob` declarations on the paginator and list views). Marking persistent containers as live regions is the reliable way to get those appended messages announced -- assistive technology is far more consistent about reporting mutations inside a live region that already existed than about noticing a brand new node that happens to carry `role="alert"`. `aria-atomic="false"` so that only the newly added message is announced rather than every message currently on screen. The individual messages keep their `role="alert"`, which is what covers the other delivery path: a normal full page load after a redirect, where the message is already in the markup when the page is parsed and a live region would (correctly) stay silent. {% endcomment %}
{% for message in messages %} {% if "header_message" in message.extra_tags|default_if_none:""|split:" " %} {% endif %} {% endfor %}
{% for message in messages %} {% with extra_tags=message.extra_tags|default_if_none:""|split:" " %} {% if "header_message" not in extra_tags %} {% if "indefinite" in extra_tags %} {% toast autohide=False content=message status=message.level_tag %} {% else %} {% toast content=message status=message.level_tag %} {% endif %} {% endif %} {% endwith %} {% endfor %}