]> git.ardis.lu - css-for-line-clamp-ellipsis/commitdiff
Update aria-label on button click
authorArdis Lu <ardisglu@gmail.com>
Wed, 24 Jan 2024 05:39:29 +0000 (21:39 -0800)
committerArdis Lu <ardisglu@gmail.com>
Wed, 24 Jan 2024 05:39:29 +0000 (21:39 -0800)
index.html

index c7f283c55dda493d49826903ce3c37252f835879..b64ae4dcb4e237de06ffbb1d848d661f02ce3feb 100644 (file)
@@ -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);
     }
 
This page took 0.036806 seconds and 4 git commands to generate.