mirror of
https://tangled.org/evan.jarrett.net/at-container-registry
synced 2026-09-25 11:44:16 +00:00
more accessiblity tweaks
This commit is contained in:
@@ -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)
|
||||
======================================== */
|
||||
|
||||
@@ -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 [];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user