I am using a Bootstrap 4 carousel and have set the attribute data-keyboard="true"
Unfortunately, the keyboard navigation feature is not working even when I focus on the carousel with the mouse first.
I want the carousel to be interactive with the keyboard as soon as the page loads.
This is my current code snippet:
<?php if( have_rows('photos') ): ?>
<div class="carousel_bg">
<div class="container">
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-keyboard="true">
<!-- Indicators -->
<ol class="carousel-indicators">
<?php
$active = 'active';
$num = 0;
while ( have_rows('photos') ) : the_row();
$photo = get_sub_field('photo');
if($photo == "" ) continue;
?>
<li data-target="#carousel-example-generic" data-slide-to="<?php echo $num ?>" class="<?php echo $active ?>"></li>
<?php
$active = '';
$num += 1;
endwhile; ?>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<?php
$active = 'active';
while ( have_rows('photos') ) : the_row();
$photo = get_sub_field('photo');
if($photo == "" ) continue;
?>
<div class="carousel-item <?php echo $active ?> screen08">
<div class="container">
<img src="<?php echo get_template_directory_uri(); ?>/files/photos/<?php the_sub_field('photo'); ?>" class="img-fluid is-slider-item" />
</div>
</div><!-- /item -->
<?php $active = '';
endwhile;
?>
</div>
</div>
</div>
</div><!-- /row -->
<?php endif; ?>
The Bootstrap 4 JavaScript library has been loaded correctly...
Any suggestions or hints would be greatly appreciated!
Thank you in advance!