mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
- toast-fragment.php: 204 early-exit now also checks flash['warning']; previously the warning was consumed by consumeFlash() then silently dropped - partage/index.php: store warning as plain text; htmlspecialchars() applied once at render time — previously htmlspecialchars() was called inside the stored string then again at output, producing ' entities etc. - partage/index.php: flash-warning div gets id + tabindex=-1; inline JS scrolls it into view and focuses it on DOMContentLoaded - admin/footer.php: htmx:afterSettle listener focuses .toast--warning after HTMX injects the toast fragment into #toast-region
27 lines
797 B
PHP
27 lines
797 B
PHP
<!-- Toast region — polled by HTMX after page load -->
|
|
<aside id="toast-region"
|
|
aria-live="polite"
|
|
hx-get="/admin/toast-fragment.php"
|
|
hx-trigger="load"
|
|
hx-swap="innerHTML"
|
|
hx-target="#toast-region">
|
|
</aside>
|
|
|
|
<?php foreach ($extraJs ?? [] as $js): ?>
|
|
<script src="<?= App::assetV($js) ?>"></script>
|
|
<?php endforeach; ?>
|
|
<?php if (!empty($extraJsInline)): ?>
|
|
<script><?= $extraJsInline ?></script>
|
|
<?php endif; ?>
|
|
<script src="/assets/js/htmx.min.js"></script>
|
|
<script>
|
|
document.body.addEventListener('htmx:afterSettle', function (e) {
|
|
if (e.target && e.target.id === 'toast-region') {
|
|
var warn = e.target.querySelector('.toast--warning');
|
|
if (warn) { warn.setAttribute('tabindex', '-1'); warn.focus(); }
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|