Skip to content

Commit ade16a8

Browse files
authored
fix: add aria-label and title to autoplay toggle buttons for accessibility (#1101)
* fix: add aria-label and title to autoplay toggle buttons for accessibility * chore: unnecessary node version removed * fix: added aria-hidden to icon * fix: aria-hidden arrows * fix: PrevArrow and NextArrow * fix: hamburger menu button translation of aria-label (#1103) * fix: aria-label fixed * removed unnecessary string * fix: title removed from buttons and icons
1 parent 3d091c1 commit ade16a8

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/components/ItaliaTheme/Blocks/Listing/Commons/NextArrow.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default function NextArrow(props) {
44
const { className, style, onClick } = props;
55
return (
66
<div className={className} style={{ ...style }} onClick={onClick}>
7-
<Icon icon="chevron-right" key="chevron-right" />
7+
<Icon icon="chevron-right" key="chevron-right" aria-hidden={true} />
88
</div>
99
);
1010
}

src/components/ItaliaTheme/Blocks/Listing/Commons/PrevArrow.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default function PrevArrow(props) {
44
const { className, style, onClick } = props;
55
return (
66
<div className={className} style={{ ...style }} onClick={onClick}>
7-
<Icon icon="chevron-left" key="chevron-left-prev" />
7+
<Icon icon="chevron-left" key="chevron-left-prev" aria-hidden={true} />
88
</div>
99
);
1010
}

src/components/ItaliaTheme/Blocks/Listing/PhotogalleryTemplate.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ const PhotogalleryTemplate = ({
116116
<div className="play-pause-wrapper">
117117
<button
118118
onClick={() => toggleAutoplay()}
119-
title={
119+
aria-label={
120120
autoplay
121121
? intl.formatMessage(messages.pause)
122122
: intl.formatMessage(messages.play)
@@ -125,6 +125,7 @@ const PhotogalleryTemplate = ({
125125
<Icon
126126
key={autoplay ? 'pause' : 'play'}
127127
icon={autoplay ? 'pause' : 'play'}
128+
aria-hidden={true}
128129
/>
129130
</button>
130131
</div>

src/components/ItaliaTheme/Blocks/Listing/SliderTemplate.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function NextArrow(props) {
7878
onKeyDown={handleKeyboardUsers}
7979
id="sliderNextArrow"
8080
>
81-
<Icon icon="chevron-right" key="chevron-right" />
81+
<Icon icon="chevron-right" key="chevron-right" aria-hidden={true} />
8282
<span class="sr-only">{intl.formatMessage(messages.successivo)}</span>
8383
</button>
8484
);
@@ -115,13 +115,12 @@ function PrevArrow(props) {
115115
className={className}
116116
style={{ ...style }}
117117
onClick={handleClick}
118-
title={intl.formatMessage(messages.precedente)}
119118
aria-label={intl.formatMessage(messages.precedente)}
120119
aria-hidden={false}
121120
id="sliderPrevArrow"
122121
onKeyDown={handleKeyboardUsers}
123122
>
124-
<Icon icon="chevron-left" key="chevron-left-prev" />
123+
<Icon icon="chevron-left" key="chevron-left-prev" aria-hidden={true} />
125124
<span class="sr-only">{intl.formatMessage(messages.precedente)}</span>
126125
</button>
127126
);
@@ -329,7 +328,7 @@ const SliderTemplate = ({
329328
<div className="play-pause-wrapper">
330329
<button
331330
onClick={toggleAutoplay}
332-
title={
331+
aria-label={
333332
userAutoplay
334333
? intl.formatMessage(messages.pause)
335334
: intl.formatMessage(messages.play)
@@ -339,6 +338,7 @@ const SliderTemplate = ({
339338
<Icon
340339
key={userAutoplay ? 'pause' : 'play'}
341340
icon={userAutoplay ? 'pause' : 'play'}
341+
aria-hidden={true}
342342
/>
343343
<span>{userAutoplay ? 'pause' : 'play'}</span>
344344
</button>

0 commit comments

Comments
 (0)