Skip to content

Commit 28dce93

Browse files
MikeListerajhillman-ddj
authored andcommitted
Improving aria-labels and removing case-sensitivity for heading levels
1 parent 5e21219 commit 28dce93

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/lib/components/ui/Accordion.svelte

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@
154154
class="govuk-accordion__section-button"
155155
aria-expanded={isExpanded}
156156
onclick={() => toggleSection(section.uniqueid)}
157-
aria-label="{section.heading}, {section?.summary}, {isExpanded
158-
? hideSectionAriaLabel
159-
: showSectionAriaLabel}"
157+
aria-label="{section.heading}, {section.summary
158+
? section.summary + ','
159+
: ''} {isExpanded ? hideSectionAriaLabel : showSectionAriaLabel}"
160160
>
161161
<span class="govuk-accordion__section-heading-text">
162162
<span class="govuk-accordion__section-heading-text-focus"
@@ -197,23 +197,23 @@
197197
class:govuk-accordion__section--expanded={isExpanded}
198198
>
199199
<div class="govuk-accordion__section-header">
200-
{#if headingLevel == 'h2'}
200+
{#if headingLevel.toLowerCase() == 'h2'}
201201
<h2 class="govuk-accordion__section-heading">
202202
{@render content(section, isExpanded)}
203203
</h2>
204-
{:else if headingLevel == 'h3'}
204+
{:else if headingLevel.toLowerCase() == 'h3'}
205205
<h3 class="govuk-accordion__section-heading">
206206
{@render content(section, isExpanded)}
207207
</h3>
208-
{:else if headingLevel == 'h4'}
208+
{:else if headingLevel.toLowerCase() == 'h4'}
209209
<h4 class="govuk-accordion__section-heading">
210210
{@render content(section, isExpanded)}
211211
</h4>
212-
{:else if headingLevel == 'h5'}
212+
{:else if headingLevel.toLowerCase() == 'h5'}
213213
<h5 class="govuk-accordion__section-heading">
214214
{@render content(section, isExpanded)}
215215
</h5>
216-
{:else if headingLevel == 'h6'}
216+
{:else if headingLevel.toLowerCase() == 'h6'}
217217
<h6 class="govuk-accordion__section-heading">
218218
{@render content(section, isExpanded)}
219219
</h6>
@@ -222,7 +222,6 @@
222222
<div
223223
id="{section.uniqueid}-content"
224224
class="govuk-accordion__section-content"
225-
aria-labelledby="{section.uniqueid}-heading"
226225
aria-live={ariaLiveValue}
227226
hidden={!isExpanded}
228227
>

0 commit comments

Comments
 (0)