From 6da0b87ce423f35e90379f89eba45d0b3946e839 Mon Sep 17 00:00:00 2001 From: Hannah Issermann Date: Thu, 12 Sep 2024 10:55:19 +0200 Subject: [PATCH] Improve label of copy/stackblitz buttons for accessibility, make an example with Accordion --- site/content/docs/5.3/components/accordion.md | 6 +++--- site/layouts/shortcodes/example.html | 11 ++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/site/content/docs/5.3/components/accordion.md b/site/content/docs/5.3/components/accordion.md index 8895341d1437..7b3af3d0901b 100644 --- a/site/content/docs/5.3/components/accordion.md +++ b/site/content/docs/5.3/components/accordion.md @@ -25,7 +25,7 @@ To render an accordion that's expanded by default: - add the `.show` class on the `.accordion-collapse` element. - drop the `.collapsed` class from the `.accordion-button` element and set its `aria-expanded` attribute to `true`. -{{< example >}} +{{< example buttons_label="standard accordion example">}}

@@ -70,7 +70,7 @@ To render an accordion that's expanded by default: Add `.accordion-flush` to remove some borders and rounded corners to render accordions edge-to-edge with their parent container. -{{< example class="bg-body-secondary" buttons_labels="flush accordion example">}} +{{< example class="bg-body-secondary" buttons_label="flush accordion example">}}

@@ -109,7 +109,7 @@ Add `.accordion-flush` to remove some borders and rounded corners to render acco Omit the `data-bs-parent` attribute on each `.accordion-collapse` to make accordion items stay open when another item is opened. -{{< example >}} +{{< example buttons_label="always opened accordion example">}}

diff --git a/site/layouts/shortcodes/example.html b/site/layouts/shortcodes/example.html index a985e022fe3e..1a8124b600e9 100644 --- a/site/layouts/shortcodes/example.html +++ b/site/layouts/shortcodes/example.html @@ -8,7 +8,7 @@ * show_markup: if the markup should be output in the HTML - default: `true` * show_preview: if the preview should be output in the HTML - default: `true` * stackblitz_add_js: if extra JS snippet should be added to StackBlitz - default: `false` - * buttons_labels: label to apply to complete 'Try it on Stackblitz' and 'Copy to clipboard' buttons - default: "" + * buttons_label: label to apply to complete 'Try it on Stackblitz' and 'Copy to clipboard' buttons - default: "" */ -}} {{- $id := .Get "id" -}} @@ -17,14 +17,11 @@ {{- $show_markup := .Get "show_markup" | default true -}} {{- $show_preview := .Get "show_preview" | default true -}} {{- $stackblitz_add_js := .Get "stackblitz_add_js" | default false -}} -{{- $buttons_labels := .Get "buttons_labels" | default "" -}} +{{- $buttons_label := .Get "buttons_label" | default "" -}} {{- $content := .Inner -}}
- {{- if eq $buttons_labels "" }}toto{{ else }} {{ $buttons_labels }} {{- end }} - {{- if not (eq $buttons_labels "") }} {{ $buttons_labels }} {{- end }} - {{- if eq $show_preview true }} {{ $content }} @@ -36,10 +33,10 @@
{{ $lang }}
- -