fix: toast visibility — opaque backgrounds and flash scope matching with query strings
Two bugs in the toast redesign: 1. Variant backgrounds (success/warning/info/error) used rgba with 12-20% opacity, making toasts semi-transparent over page content. Fixed by layering the tint over a solid background via linear-gradient compositing. 2. Flash messages with scoped paths including query strings (e.g. edit pages with ?return=...) were not matched by Flash::peek(Request::path()) since path() strips the query. Added fallback to pathWithQuery() matching. Also moved flash partial before JS init scripts to ensure DOM is present when the component runtime mounts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -145,7 +145,7 @@ $componentPageConfig = [
|
||||
'components' => [
|
||||
'confirmActions' => [],
|
||||
'flashAutoDismiss' => [
|
||||
'selector' => '.app-toast-stack .notice[data-flash-timeout]',
|
||||
'selector' => '.notice[data-flash-timeout]',
|
||||
],
|
||||
'passwordHints' => [],
|
||||
'copyBadge' => [],
|
||||
@@ -358,8 +358,8 @@ $componentPageConfig['moduleRuntimeComponents'] = $moduleRuntimeComponents;
|
||||
?>
|
||||
<?php endforeach; ?>
|
||||
<script type="application/json" id="page-config-app-components"><?php gridJsonForJs($componentPageConfig); ?></script>
|
||||
<script type="module" src="<?php e(assetVersion('js/app-init.js')); ?>"></script>
|
||||
<?php require __DIR__ . '/partials/app-flash.phtml'; ?>
|
||||
<script type="module" src="<?php e(assetVersion('js/app-init.js')); ?>"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -15,7 +15,7 @@ if ($bufferTitle !== '') {
|
||||
$loginComponentConfig = [
|
||||
'components' => [
|
||||
'flashAutoDismiss' => [
|
||||
'selector' => '.app-toast-stack .notice[data-flash-timeout]',
|
||||
'selector' => '.notice[data-flash-timeout]',
|
||||
],
|
||||
'passwordHints' => [
|
||||
'selector' => '[data-password-hints]',
|
||||
@@ -65,8 +65,8 @@ $loginComponentConfig = [
|
||||
<?php require __DIR__ . '/partials/app-footer.phtml'; ?>
|
||||
<div id="gradient"></div>
|
||||
<script type="application/json" id="page-config-login-components"><?php gridJsonForJs($loginComponentConfig); ?></script>
|
||||
<script type="module" src="<?php e(assetVersion('js/app-login-init.js')); ?>"></script>
|
||||
<?php require __DIR__ . '/partials/app-flash.phtml'; ?>
|
||||
<script type="module" src="<?php e(assetVersion('js/app-login-init.js')); ?>"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -4,7 +4,7 @@ use MintyPHP\Support\Flash;
|
||||
use MintyPHP\Http\Request;
|
||||
use MintyPHP\Session;
|
||||
|
||||
$messages = Flash::peek(Request::path());
|
||||
$messages = Flash::peek(Request::path()) ?: Flash::peek(Request::pathWithQuery());
|
||||
if (!$messages) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user