From 0201cbd382139c203cd7f029eae3d21474146d67 Mon Sep 17 00:00:00 2001 From: Dylan Hyun Date: Thu, 22 May 2025 14:25:04 -0400 Subject: [PATCH 1/2] HDS-3349 `CodeBlock` a11y improvements docs updates --- .../components/code-block/partials/code/component-api.md | 9 +++++++++ .../components/code-block/partials/code/how-to-use.md | 8 +++++++- .../code-editor/partials/code/component-api.md | 3 +++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/website/docs/components/code-block/partials/code/component-api.md b/website/docs/components/code-block/partials/code/component-api.md index e1ced3a1dbd..add942551a5 100644 --- a/website/docs/components/code-block/partials/code/component-api.md +++ b/website/docs/components/code-block/partials/code/component-api.md @@ -11,6 +11,15 @@ This component uses [prism.js](https://prismjs.com/) under the hood. `ContentBlock::Description` yielded as contextual component (see below). + + Accepts a localized string. The `ariaLabel` value is applied to the code block pre element. + + + Accepts a localized string. The `ariaLabelledBy` value is applied to the code block pre element. + + + Accepts a localized string. The `ariaDescribedBy` value is applied to the code block pre element. + The text/code content for the `CodeBlock`. The component encodes this argument before displaying it. diff --git a/website/docs/components/code-block/partials/code/how-to-use.md b/website/docs/components/code-block/partials/code/how-to-use.md index 28214b85448..1de194e3fec 100644 --- a/website/docs/components/code-block/partials/code/how-to-use.md +++ b/website/docs/components/code-block/partials/code/how-to-use.md @@ -1,6 +1,6 @@ ## How to use this component -The basic invocation requires a `@value` argument. The component encodes this argument before displaying it. +The basic invocation requires a `@value` argument. The component encodes this argument before displaying it. To use this component, you must either include the yielded `Title` component, provide an `@ariaLabel`, or specify an `@ariaLabelledBy`. !!! Info @@ -10,6 +10,7 @@ If the `\n` escape sequence is used in the `@value` string in Handlebars, it wil ```handlebars ``` @@ -70,6 +71,7 @@ The `language` argument sets the syntax highlighting used. We only support the f ```handlebars Accepts a localized string. The `ariaLabelledBy` value is applied to the code editor input element. + + Accepts a localized string. The `ariaDescribedBy` value is applied to the code editor input element. + Used to control whether a copy button for copying the code/text content will be displayed. From c6ee629d5e0259267ac740a651c6ecf28b6a616c Mon Sep 17 00:00:00 2001 From: Dylan Hyun Date: Wed, 4 Jun 2025 14:43:17 -0400 Subject: [PATCH 2/2] Fix: Code Block move aria args text block --- .../docs/components/code-block/partials/code/how-to-use.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website/docs/components/code-block/partials/code/how-to-use.md b/website/docs/components/code-block/partials/code/how-to-use.md index 1de194e3fec..a8763b3795c 100644 --- a/website/docs/components/code-block/partials/code/how-to-use.md +++ b/website/docs/components/code-block/partials/code/how-to-use.md @@ -1,6 +1,8 @@ ## How to use this component -The basic invocation requires a `@value` argument. The component encodes this argument before displaying it. To use this component, you must either include the yielded `Title` component, provide an `@ariaLabel`, or specify an `@ariaLabelledBy`. +To use this component, you must either include the yielded `Title` component, provide an `@ariaLabel`, or specify an `@ariaLabelledBy`. + +The basic invocation requires a `@value` argument. The component encodes this argument before displaying it. !!! Info