Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 713ecd2

Browse filesBrowse files
committed
refactor(carousel-inner): add aria-live "off" for interval > 0, otherwise "polite"
1 parent c535347 commit 713ecd2
Copy full SHA for 713ecd2

File tree

Expand file treeCollapse file tree

1 file changed

+9
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-2
lines changed

‎projects/coreui-angular/src/lib/carousel/carousel-inner/carousel-inner.component.ts

Copy file name to clipboardExpand all lines: projects/coreui-angular/src/lib/carousel/carousel-inner/carousel-inner.component.ts
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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
})
2526
export 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

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.