more accessiblity tweaks

This commit is contained in:
Evan Jarrett
2026-01-17 16:43:54 -06:00
parent ebb107ebec
commit 26f049fcbe
13 changed files with 68 additions and 25 deletions
+13
View File
@@ -100,6 +100,19 @@
}
}
/* ========================================
ACCESSIBILITY UTILITIES
======================================== */
@layer utilities {
/* Screen reader only - visually hidden but accessible */
.sr-only {
@apply absolute w-px h-px p-0 -m-px overflow-hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
}
/* ========================================
CUSTOM COMPONENTS (Not in DaisyUI)
======================================== */
+27 -3
View File
@@ -104,10 +104,15 @@ document.addEventListener('DOMContentLoaded', () => {
});
// Copy to clipboard
function copyToClipboard(text) {
// text: the text to copy
// btn: optional button element for feedback (uses event.target if not provided)
function copyToClipboard(text, btn) {
if (!btn && typeof event !== 'undefined') {
btn = event.target.closest('button');
}
navigator.clipboard.writeText(text).then(() => {
if (!btn) return;
// Show success feedback
const btn = event.target.closest('button');
const originalHTML = btn.innerHTML;
btn.innerHTML = '<i data-lucide="check"></i> Copied!';
// Re-initialize Lucide icons for the new icon
@@ -126,6 +131,25 @@ function copyToClipboard(text) {
});
}
// Initialize copy buttons with data-cmd attribute and clickable cards with data-href
document.addEventListener('DOMContentLoaded', () => {
document.addEventListener('click', (e) => {
// Handle copy buttons
const btn = e.target.closest('button[data-cmd]');
if (btn) {
copyToClipboard(btn.getAttribute('data-cmd'), btn);
return;
}
// Handle clickable cards (skip if clicking on interactive elements)
if (e.target.closest('a, button, input, .cmd')) return;
const card = e.target.closest('[data-href]');
if (card) {
window.location = card.getAttribute('data-href');
}
});
});
// Time ago helper (for client-side rendering)
function timeAgo(date) {
const seconds = Math.floor((new Date() - new Date(date)) / 1000);
@@ -465,7 +489,7 @@ class RecentAccountsHelper {
try {
const recent = localStorage.getItem('atcr_recent_handles');
return recent ? JSON.parse(recent) : [];
} catch {
} catch (_) {
return [];
}
}