mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
fix: duplicate warning not shown in admin, double-encoded in partage, no focus
- 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
This commit is contained in:
@@ -14,5 +14,13 @@
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user