Skip to content

Commit

Permalink
Jwoo/js keyboard fix (#8299)
Browse files Browse the repository at this point in the history
* this is test changes

* disabled keyboard navigation by arrows key

* revert package changes
  • Loading branch information
jwoo-msft committed Feb 16, 2023
1 parent ff3d939 commit 9de248c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion source/nodejs/adaptivecards/src/carousel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ export class Carousel extends Container {
enabled: true
},
keyboard: {
enabled: true,
enabled: false,
onlyInViewport: true
},
direction: this.carouselOrientation === Enums.Orientation.Horizontal ? "horizontal" : "vertical",
Expand Down Expand Up @@ -605,6 +605,17 @@ export class Carousel extends Container {
this.raiseCarouselEvent(Enums.CarouselInteractionEvent.Autoplay);
});

carousel.on('paginationRender', (swiper, paginationEl) => {
swiper.pagination.bullets.forEach((bullet, index) => {
bullet.addEventListener("keypress", function(event : KeyboardEvent) {
if (event.key == "Enter") {
event.preventDefault();
swiper.slideTo(index + 1);
}
});
});
});

carousel.on('destroy', () => {
this.destroyResizeObserver();
});
Expand Down

0 comments on commit 9de248c

Please sign in to comment.