From: Ardis Lu Date: Wed, 24 Jan 2024 05:39:29 +0000 (-0800) Subject: Update aria-label on button click X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=54bc72642996751fd78165735aca9f0396a2e77e;p=css-for-line-clamp-ellipsis Update aria-label on button click --- diff --git a/index.html b/index.html index c7f283c..b64ae4d 100644 --- a/index.html +++ b/index.html @@ -396,12 +396,14 @@ new ResizeObserver(debounce(() => { const button = event.target; const code = button.closest('pre').querySelector('code').textContent; navigator.clipboard.writeText(code); + button.setAttribute('aria-label', 'Copied!'); const svg = button.querySelector('svg'); svg.style.setProperty('stroke', 'green'); svg.innerHTML = checkSVG; setTimeout(() => { svg.innerHTML = clipboardSVG; svg.style.setProperty('stroke', 'currentColor'); + button.setAttribute('aria-label', 'Copy'); }, 2000); }