@@ -19,21 +19,27 @@ import { carouselPlay } from '../carousel.animation';
1919 host : {
2020 class : 'carousel-inner' ,
2121 '[@carouselPlay]' : 'slideType()' ,
22- '[@.disabled]' : '!animate()'
22+ '[@.disabled]' : '!animate()' ,
23+ '[attr.aria-live]' : 'ariaLive()'
2324 }
2425} )
2526export class CarouselInnerComponent implements AfterContentInit , AfterContentChecked {
2627 readonly #carouselState = inject ( CarouselState ) ;
2728
2829 readonly activeIndex = signal < number | undefined > ( undefined ) ;
2930 readonly animate = signal < boolean > ( true ) ;
31+ readonly interval = signal < number > ( 0 ) ;
3032 readonly slide = signal ( { left : true } ) ;
3133 readonly transition = signal ( 'crossfade' ) ;
3234
3335 readonly slideType = computed ( ( ) => {
3436 return { left : this . slide ( ) . left , type : this . transition ( ) } ;
3537 } ) ;
3638
39+ readonly ariaLive = computed ( ( ) => {
40+ return this . interval ( ) ? 'off' : 'polite' ;
41+ } ) ;
42+
3743 readonly contentItems = contentChildren ( CarouselItemComponent ) ;
3844 readonly #prevContentItems = signal < CarouselItemComponent [ ] > ( [ ] ) ;
3945
@@ -48,8 +54,9 @@ export class CarouselInnerComponent implements AfterContentInit, AfterContentChe
4854 const nextDirection = state ?. direction ;
4955 if ( this . activeIndex ( ) !== nextIndex ) {
5056 this . animate . set ( state ?. animate ?? false ) ;
51- this . slide . set ( { left : nextDirection === 'next' } ) ;
5257 this . activeIndex . set ( state ?. activeItemIndex ) ;
58+ this . interval . set ( state ?. interval ?? 0 ) ;
59+ this . slide . set ( { left : nextDirection === 'next' } ) ;
5360 this . transition . set ( state ?. transition ?? 'slide' ) ;
5461 }
5562 }
0 commit comments