My school is using the W3Schools flip card code for interactivity on our class pages, with some added JavaScript to keep the cards flipped when clicked or tapped. However, I don't think they are accessible for screen readers. It seems like they need some ARIA code, and I am very new to ARIA. How can I make sure students using screen readers can use the flip cards?
I added some ARIA code, but I'm not sure if it's right or useful. Does it make sense that the front side controls the back side and vice versa? I'm also using JavaScript to toggle the aria-expanded between true and false when the cards are flipped.
<div class="flip-card">
<div class="flip-card-inner" tabindex="0">
<div class="flip-card-front" role="button" aria-expanded="true" id="flip-card-front_4" aria-controls="flip-card-back_4">
<p>Front of card</p>
</div>
<div class="flip-card-back" role="button" aria-expanded="false" id="flip-card-back_4" aria-controls="flip-card-front_4">
<p>Back of card</p>
</div>
</div>
</div>