Compare commits

...

2 Commits

Author SHA1 Message Date
295e6b3069 fix: replace blocking alert() with accessible toast notifications
All checks were successful
Sanity Checks / sanity-test (pull_request) Successful in 9s
Smoke Test / smoke (pull_request) Successful in 15s
Fixes #73

Safety plan save feedback used blocking browser alert() dialogs.
Replaced with inline toast notifications using aria-live="polite"
for accessible, non-blocking feedback.
2026-04-17 05:45:59 +00:00
d412939b4f fix: footer /about link to point to static about.html
Fixes #59

The footer links to /about but the repo ships about.html. On a plain static server this results in a 404. Changed to /about.html so the link resolves correctly.
2026-04-17 05:37:40 +00:00

View File

@@ -613,6 +613,31 @@ html, body {
top: 8px;
outline: 2px solid #58a6ff;
}
/* ===== TOAST NOTIFICATION (fix #73) ===== */
.toast-notification {
position: fixed;
bottom: 24px;
left: 50%;
transform: translateX(-50%) translateY(100px);
padding: 12px 24px;
border-radius: 8px;
font-size: 0.9rem;
font-weight: 500;
z-index: 10001;
opacity: 0;
transition: transform 0.3s ease, opacity 0.3s ease;
pointer-events: none;
max-width: 90vw;
text-align: center;
}
.toast-notification.visible {
transform: translateX(-50%) translateY(0);
opacity: 1;
}
.toast-notification.success { background: #238636; color: #fff; }
.toast-notification.error { background: #da3633; color: #fff; }
</style>
</head>
<body>
@@ -680,7 +705,7 @@ html, body {
<!-- Footer -->
<footer id="footer">
<a href="/about" aria-label="About The Door">about</a>
<a href="/about.html" aria-label="About The Door">about</a>
<button id="safety-plan-btn" aria-label="Open My Safety Plan">my safety plan</button>
<button id="clear-chat-btn" aria-label="Clear chat history">clear chat</button>
</footer>
@@ -1196,7 +1221,24 @@ Sovereignty and service always.`;
});
saveSafetyPlan.addEventListener('click', function() {
var plan = {
var
// ===== TOAST NOTIFICATION (fix #73) =====
var _toastEl = document.getElementById('toast-notification');
var _toastTimer = null;
function showToast(message, type) {
type = type || 'success';
_toastEl.textContent = message;
_toastEl.className = 'toast-notification ' + type;
void _toastEl.offsetHeight; // force reflow before transition
_toastEl.classList.add('visible');
if (_toastTimer) clearTimeout(_toastTimer);
_toastTimer = setTimeout(function() {
_toastEl.classList.remove('visible');
}, 3000);
}
plan = {
warningSigns: document.getElementById('sp-warning-signs').value,
coping: document.getElementById('sp-coping').value,
distraction: document.getElementById('sp-distraction').value,
@@ -1207,9 +1249,9 @@ Sovereignty and service always.`;
localStorage.setItem('timmy_safety_plan', JSON.stringify(plan));
safetyPlanModal.classList.remove('active');
_restoreSafetyPlanFocus();
alert('Safety plan saved locally.');
showToast('Safety plan saved.', 'success');
} catch (e) {
alert('Error saving plan.');
showToast('Error saving plan.', 'error');
}
});
@@ -1463,5 +1505,10 @@ Sovereignty and service always.`;
})();
</script>
<!-- Toast notification (fix #73) -->
<div id="toast-notification" class="toast-notification"
role="status" aria-live="polite" aria-atomic="true"></div>
</body>
</html>