@@ -19,21 +19,27 @@ import { carouselPlay } from '../carousel.animation';
19
19
host : {
20
20
class : 'carousel-inner' ,
21
21
'[@carouselPlay]' : 'slideType()' ,
22
- '[@.disabled]' : '!animate()'
22
+ '[@.disabled]' : '!animate()' ,
23
+ '[attr.aria-live]' : 'ariaLive()'
23
24
}
24
25
} )
25
26
export class CarouselInnerComponent implements AfterContentInit , AfterContentChecked {
26
27
readonly #carouselState = inject ( CarouselState ) ;
27
28
28
29
readonly activeIndex = signal < number | undefined > ( undefined ) ;
29
30
readonly animate = signal < boolean > ( true ) ;
31
+ readonly interval = signal < number > ( 0 ) ;
30
32
readonly slide = signal ( { left : true } ) ;
31
33
readonly transition = signal ( 'crossfade' ) ;
32
34
33
35
readonly slideType = computed ( ( ) => {
34
36
return { left : this . slide ( ) . left , type : this . transition ( ) } ;
35
37
} ) ;
36
38
39
+ readonly ariaLive = computed ( ( ) => {
40
+ return this . interval ( ) ? 'off' : 'polite' ;
41
+ } ) ;
42
+
37
43
readonly contentItems = contentChildren ( CarouselItemComponent ) ;
38
44
readonly #prevContentItems = signal < CarouselItemComponent [ ] > ( [ ] ) ;
39
45
@@ -48,8 +54,9 @@ export class CarouselInnerComponent implements AfterContentInit, AfterContentChe
48
54
const nextDirection = state ?. direction ;
49
55
if ( this . activeIndex ( ) !== nextIndex ) {
50
56
this . animate . set ( state ?. animate ?? false ) ;
51
- this . slide . set ( { left : nextDirection === 'next' } ) ;
52
57
this . activeIndex . set ( state ?. activeItemIndex ) ;
58
+ this . interval . set ( state ?. interval ?? 0 ) ;
59
+ this . slide . set ( { left : nextDirection === 'next' } ) ;
53
60
this . transition . set ( state ?. transition ?? 'slide' ) ;
54
61
}
55
62
}
0 commit comments