Skip to content

Commit 0c5ac7b

Browse files
committed
Fix duplicate landmark in Carousel component
1 parent 1e7b947 commit 0c5ac7b

3 files changed

Lines changed: 41 additions & 32 deletions

File tree

axe-results-violations.json

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,42 +16,49 @@
1616
"id": "landmark-is-unique",
1717
"data": {
1818
"role": "region",
19-
"accessibleText": "building the future of software development"
19+
"accessibleText": null
2020
},
2121
"relatedNodes": [
2222
{
23-
"html": "<section class=\"bg-content rounded-2xl p-8 md:p-12 overflow-hidden relative\" aria-labelledby=\"home-about-title\">",
23+
"html": "<div class=\"embla relative\" role=\"region\" data-astro-cid-kfjqoxel=\"\">",
2424
"target": [
25-
".md\\:p-12"
25+
".mb-0:nth-child(2) > carousel-slider > .py-8.lg\\:px-8.px-4 > .embla.relative[role=\"region\"]"
2626
]
27-
}
28-
],
29-
"impact": "moderate",
30-
"message": "The landmark must have a unique aria-label, aria-labelledby, or title to make landmarks distinguishable"
31-
}
32-
],
33-
"all": [],
34-
"none": [],
35-
"impact": "moderate",
36-
"html": "<section class=\"container mx-auto px-4 sm:px-6 lg:px-8 py-4 md:py-8 lg:py-12\" aria-labelledby=\"home-about-title\">",
37-
"target": [
38-
".md\\:py-8.lg\\:py-12[aria-labelledby=\"home-about-title\"]"
39-
],
40-
"failureSummary": "Fix any of the following:\n The landmark must have a unique aria-label, aria-labelledby, or title to make landmarks distinguishable"
41-
},
42-
{
43-
"any": [
44-
{
45-
"id": "landmark-is-unique",
46-
"data": {
47-
"role": "region",
48-
"accessibleText": "technologies & expertise"
49-
},
50-
"relatedNodes": [
27+
},
28+
{
29+
"html": "<div class=\"embla relative\" role=\"region\" data-astro-cid-kfjqoxel=\"\">",
30+
"target": [
31+
".mb-0:nth-child(3) > carousel-slider > .py-8.lg\\:px-8.px-4 > .embla.relative[role=\"region\"]"
32+
]
33+
},
34+
{
35+
"html": "<div class=\"embla relative\" role=\"region\" data-astro-cid-kfjqoxel=\"\">",
36+
"target": [
37+
".mb-0:nth-child(4) > carousel-slider > .py-8.lg\\:px-8.px-4 > .embla.relative[role=\"region\"]"
38+
]
39+
},
40+
{
41+
"html": "<div class=\"embla relative\" role=\"region\" data-astro-cid-kfjqoxel=\"\">",
42+
"target": [
43+
".mb-0:nth-child(5) > carousel-slider > .py-8.lg\\:px-8.px-4 > .embla.relative[role=\"region\"]"
44+
]
45+
},
46+
{
47+
"html": "<div class=\"embla relative\" role=\"region\" data-astro-cid-kfjqoxel=\"\">",
48+
"target": [
49+
".mb-0:nth-child(6) > carousel-slider > .py-8.lg\\:px-8.px-4 > .embla.relative[role=\"region\"]"
50+
]
51+
},
52+
{
53+
"html": "<div class=\"embla relative\" role=\"region\" data-astro-cid-kfjqoxel=\"\">",
54+
"target": [
55+
".mb-0:nth-child(7) > carousel-slider > .py-8.lg\\:px-8.px-4 > .embla.relative[role=\"region\"]"
56+
]
57+
},
5158
{
52-
"html": "<skills-carousel class=\"block\" role=\"region\" aria-roledescription=\"carousel\" aria-labelledby=\"home-technologies-title\" data-carousel-autoplay=\"paused\" data-carousel-ready=\"true\">",
59+
"html": "<div class=\"embla relative\" role=\"region\" data-astro-cid-kfjqoxel=\"\">",
5360
"target": [
54-
"skills-carousel"
61+
".mb-0:nth-child(8) > carousel-slider > .py-8.lg\\:px-8.px-4 > .embla.relative[role=\"region\"]"
5562
]
5663
}
5764
],
@@ -62,9 +69,9 @@
6269
"all": [],
6370
"none": [],
6471
"impact": "moderate",
65-
"html": "<section class=\"container mx-auto px-4 sm:px-6 lg:px-8 py-4 md:py-8 lg:py-12 hidden md:block -mb-12\" aria-labelledby=\"home-technologies-title\">",
72+
"html": "<div class=\"embla relative\" role=\"region\" data-astro-cid-kfjqoxel=\"\">",
6673
"target": [
67-
".md\\:block"
74+
".mb-0:nth-child(1) > carousel-slider > .py-8.lg\\:px-8.px-4 > .embla.relative[role=\"region\"]"
6875
],
6976
"failureSummary": "Fix any of the following:\n The landmark must have a unique aria-label, aria-labelledby, or title to make landmarks distinguishable"
7077
}

src/components/Carousel/client/__tests__/index.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ describe('Carousel component (server output)', () => {
208208
const region = root.querySelector('.embla')
209209

210210
expect(heading).toBeNull()
211+
expect(region?.getAttribute('role')).toBeNull()
211212
expect(region?.getAttribute('aria-labelledby')).toBeNull()
212213
},
213214
{ title: '', variant: 'suggested' }

src/components/Carousel/index.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ const items = prepareItems(allItems, variant, currentSlug, limit)
7474
7575
const carouselId = `carousel-${type}-${variant}-${currentSlug ?? 'all'}`
7676
const carouselRegionLabelledBy = title ? `${carouselId}-title` : undefined
77+
const carouselRegionRole = carouselRegionLabelledBy ? 'region' : undefined
7778
---
7879

7980
{
@@ -99,7 +100,7 @@ const carouselRegionLabelledBy = title ? `${carouselId}-title` : undefined
99100
)}
100101

101102
{/* Embla Carousel */}
102-
<div class="embla relative" role="region" aria-labelledby={carouselRegionLabelledBy}>
103+
<div class="embla relative" role={carouselRegionRole} aria-labelledby={carouselRegionLabelledBy}>
103104
<div class="embla__viewport overflow-hidden p-4">
104105
<div class="embla__container flex -ml-4 md:-ml-6">
105106
{items.map((item: ItemType, index) => (

0 commit comments

Comments
 (0)