Skip to content

Commit

Permalink
fix a11y
Browse files Browse the repository at this point in the history
  • Loading branch information
namachan10777 committed Jun 30, 2024
1 parent 0fce887 commit 9c761c0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/shiki-copy-button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function shikiCopyButton(): ShikiTransformer {
tagName: "button",
properties: {
class: "shiki-copy-button",
"aria-label": "コードをコピーする",
},
children: [copy, check],
},
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/components/composite/MdArticle.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<script>
document.querySelectorAll("button.shiki-copy-button").forEach((element) => {
const button = element as HTMLButtonElement;
console.log(button);
button.addEventListener("click", () => {
const text = button.parentNode?.querySelector("code")?.textContent;
if (text) {
Expand Down Expand Up @@ -55,6 +54,7 @@
position: absolute;
right: 0.3rem;
top: 0.3rem;
cursor: pointer;
}

article :global(pre button[data-copied="true"] .shiki-copy-button-copy) {
Expand Down

0 comments on commit 9c761c0

Please sign in to comment.