left4me/l4d2web/l4d2web/templates/_modal_partial.html
mwiegand 74fd906cf4
docs(modals): codify URL-addressable modal template convention
Architectural problem flagged after the pilot: "the template renders both
as a standalone page AND as a modal fragment" contract is non-obvious for
future template authors. Task 2 originally used <dialog>, Task 8.5 had to
undo that because nested <dialog> collapses to 2px. The convention is now
in two places:

1. AGENTS.md gains a "URL-addressable modal templates" section under
   Non-Negotiable Constraints listing: outer element must be <div>, close
   buttons use data-modal-dismiss, form actions need #modal-content-scoped
   document delegation, modal chrome CSS is owned by the outer slot.
2. _modal_partial.html (the file template authors will most likely open
   when wondering "what's this layout?") carries a Jinja comment header
   summarising the rule + linking to AGENTS.md for the full convention.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 14:09:05 +02:00

9 lines
593 B
HTML

{# Modal-fragment layout. Templates that extend `base_layout` render through
this when the request carries `HX-Modal: 1` (see `inject_base_layout` in
app.py). The persistent <dialog id="modal-container"> in base.html provides
top-layer + backdrop + focus-trap + Esc-to-close semantics. Templates that
extend base_layout MUST NOT wrap their content in a <dialog> — nested
<dialog> collapses to 2px. Use a <div> root and let the outer slot own
dialog semantics. See AGENTS.md "URL-addressable modal templates" for the
full convention. #}
{% block content %}{% endblock %}