@@ -184,28 +184,12 @@ class Carousel extends AutoControlledComponent<WithAsProp<CarouselProps>, Carous
184
184
this . showPreviousSlide ( e , true )
185
185
} ,
186
186
showNextSlideByPaddlePress : e => {
187
- e . preventDefault ( )
188
- const { activeIndex } = this . state
189
- const { circular, items, navigation } = this . props
190
-
191
- this . showNextSlide ( e , false )
192
-
193
- // if 'next' paddle will disappear, will focus 'previous' one.
194
- if ( ! navigation && activeIndex >= items . length - 2 && ! circular ) {
195
- this . paddlePreviousRef . current . focus ( )
196
- }
187
+ e . preventDefault ( )
188
+ this . showNextSlide ( e , false )
197
189
} ,
198
190
showPreviousSlideByPaddlePress : e => {
199
191
e . preventDefault ( )
200
- const { activeIndex } = this . state
201
- const { circular, navigation } = this . props
202
-
203
192
this . showPreviousSlide ( e , false )
204
-
205
- // if 'previous' paddle will disappear, will focus 'next' one.
206
- if ( ! navigation && activeIndex <= 1 && ! circular ) {
207
- this . paddleNextRef . current . focus ( )
208
- }
209
193
} ,
210
194
}
211
195
@@ -260,7 +244,8 @@ class Carousel extends AutoControlledComponent<WithAsProp<CarouselProps>, Carous
260
244
< div style = { styles . itemsContainerWrapper } { ...accessibility . attributes . itemsContainerWrapper } >
261
245
< div
262
246
className = { Carousel . slotClassNames . itemsContainer }
263
- aria-roledescription = { ariaRoleDescription }
247
+ aria-roledescription = { ariaRoleDescription }
248
+ aria-label = "Portrait collection"
264
249
style = { styles . itemsContainer }
265
250
{ ...accessibility . attributes . itemsContainer }
266
251
{ ...applyAccessibilityKeyHandlers (
@@ -294,10 +279,18 @@ class Carousel extends AutoControlledComponent<WithAsProp<CarouselProps>, Carous
294
279
295
280
showPreviousSlide = ( e : React . SyntheticEvent , focusItem : boolean ) => {
296
281
this . setActiveIndex ( e , this . state . activeIndex - 1 , focusItem )
282
+ // if 'previous' paddle will disappear, will focus 'next' one.
283
+ if ( ! this . props . navigation && this . state . activeIndex <= 1 && ! this . props . circular ) {
284
+ this . paddleNextRef . current . focus ( )
285
+ }
297
286
}
298
287
299
288
showNextSlide = ( e : React . SyntheticEvent , focusItem : boolean ) => {
300
289
this . setActiveIndex ( e , this . state . activeIndex + 1 , focusItem )
290
+ // if 'next' paddle will disappear, will focus 'previous' one.
291
+ if ( ! this . props . navigation && this . state . activeIndex >= this . props . items . length - 2 && ! this . props . circular ) {
292
+ this . paddlePreviousRef . current . focus ( )
293
+ }
301
294
}
302
295
303
296
handlePaddleOverrides = ( predefinedProps : ButtonProps , paddleName : string ) => ( {
@@ -390,6 +383,7 @@ class Carousel extends AutoControlledComponent<WithAsProp<CarouselProps>, Carous
390
383
} )
391
384
) : (
392
385
< Text
386
+ aria-hidden = "true"
393
387
className = { Carousel . slotClassNames . pagination }
394
388
content = { getItemPositionText ( activeIndex , items . length ) }
395
389
/>
0 commit comments