DRY duplicated helpers (escapeAttr, belongsToForm, isSubmitControl, isEditableTarget) into web/js/core/app-form-utils.js and update 7 consumers. Add aria-live="polite" to flash messages, async messages, and search results for screen reader announcements. Add prefers-reduced-motion support to CSS tooltips. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
35 lines
1004 B
PHTML
35 lines
1004 B
PHTML
<?php
|
|
|
|
use MintyPHP\Support\Flash;
|
|
use MintyPHP\Http\Request;
|
|
use MintyPHP\Session;
|
|
|
|
$messages = Flash::peek(Request::path());
|
|
if (!$messages) {
|
|
return;
|
|
}
|
|
|
|
$returnTarget = Request::pathWithQuery();
|
|
$timeouts = [
|
|
'success' => 5000,
|
|
'info' => 6000,
|
|
'warning' => 7000,
|
|
'error' => 0,
|
|
];
|
|
|
|
?>
|
|
<div class="flash-stack" role="status" aria-live="polite">
|
|
<?php foreach ($messages as $message) : ?>
|
|
<?php $type = $message['type'] ?? 'info'; ?>
|
|
<?php $timeout = $timeouts[$type] ?? 5000; ?>
|
|
<div class="notice" data-variant="<?php e($type); ?>" data-flash-timeout="<?php e($timeout); ?>">
|
|
<?php e(t($message['message'] ?? '')); ?>
|
|
<form method="post" action="flash/dismiss/<?php e($message['id'] ?? ''); ?>">
|
|
<input type="hidden" name="return" value="<?php e($returnTarget); ?>">
|
|
<button type="submit" class="contrast outline small"><i class="bi bi-x"></i></button>
|
|
<?php Session::getCsrfInput(); ?>
|
|
</form>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|