{% comment %} Dialog/Modal Component - Unified Django Template A flexible dialog/modal component that supports both HTMX-triggered and Alpine.js-controlled modals. Includes proper accessibility attributes (ARIA) and keyboard navigation support. Usage Examples: Alpine.js controlled modal: {% include 'components/ui/dialog.html' with title='Confirm Action' content='Are you sure?' id='confirm-modal' %} HTMX triggered modal (loads content dynamically): With footer actions: {% include 'components/ui/dialog.html' with title='Delete Item' description='This cannot be undone.' footer='' %} Parameters: - id: Modal ID (used for Alpine.js state management) - title: Dialog title - description: Dialog subtitle/description - content: Main content (sanitized) - footer: Footer content with actions (sanitized) - open: Boolean to control initial open state (default: true for HTMX-loaded content) - closable: Boolean to allow closing (default: true) - size: 'sm', 'default', 'lg', 'xl', 'full' (default: 'default') - class: Additional CSS classes for the dialog panel Accessibility: - role="dialog" and aria-modal="true" for screen readers - Focus trap within modal when open - Escape key closes the modal - Click outside closes the modal (backdrop click) Security: Content and footer are sanitized to prevent XSS attacks. {% endcomment %} {% load safe_html %} {% with modal_id=id|default:'dialog' is_open=open|default:True %} {% endwith %}