Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2026-04-18 - Contextual Action Visibility
**Learning:** Using `opacity-0 group-hover:opacity-100` for contextual actions (like copy buttons) creates a clean UI but can hide functionality from keyboard users. Adding `focus:opacity-100` is a mandatory companion to ensure the element becomes visible when tabbed into.
**Action:** Always pair `group-hover:opacity-100` with `focus:opacity-100` for interactive elements to maintain WCAG accessibility.
39 changes: 38 additions & 1 deletion os2.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ <h4 class="text-lime-500 font-black text-xs uppercase mb-2">The Zest UI</h4>
</div>
</div>
</div>
<div class="code-window">
<div class="code-window group">
<button onclick="copyCode(this)" aria-label="Copy code to clipboard" class="absolute top-4 right-4 opacity-0 group-hover:opacity-100 focus:opacity-100 bg-zinc-900 hover:bg-lime-500 hover:text-black text-lime-500 px-3 py-1 text-[10px] font-black uppercase transition-all border border-zinc-700 z-10">
Copy
</button>
<pre class="text-lime-500 text-xs leading-loose">
; OS*2 SYSTEM_INIT
move rdi 10 ; ALLOC_SOVEREIGNTY
Expand Down Expand Up @@ -170,6 +173,40 @@ <h4 class="text-[10px] font-black text-slate-400 uppercase mb-6 tracking-widest"
status.innerText = "Status: Mirror_Sync_In_Progress";
}
}

function copyCode(btn) {
const pre = btn.parentElement.querySelector('pre');
const code = pre.innerText.trim();

const performCopy = () => {
if (navigator.clipboard && navigator.clipboard.writeText) {
return navigator.clipboard.writeText(code);
} else {
const textArea = document.createElement("textarea");
textArea.value = code;
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
} catch (err) {
console.error('Fallback copy failed', err);
}
document.body.removeChild(textArea);
return Promise.resolve();
}
};

performCopy().then(() => {
const originalText = btn.innerText;
btn.innerText = "COPIED!";
btn.classList.add('!bg-lime-500', '!text-black');
setTimeout(() => {
btn.innerText = originalText;
btn.classList.remove('!bg-lime-500', '!text-black');
}, 2000);
});
}

window.onload = checkAvailability;
</script>
</body>
Expand Down