Skip to content

Commit

Permalink
fix: add role="img" to star rating renderings to support aria-label u…
Browse files Browse the repository at this point in the history
…sage

PiperOrigin-RevId: 576996262
  • Loading branch information
mcreinhard authored and copybara-github committed Oct 26, 2023
1 parent ec6265d commit 874beef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/place_building_blocks/place_rating/place_rating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ export class PlaceRating extends PlaceDataConsumer {
const icons = this.condensed ? [IconType.FULL] : toStarIcons(rating!);
// clang-format off
return html`
<span aria-label=${
this.getMsg('PLACE_RATING_ARIA_LABEL', rating!.toFixed(1))}>
<span role="img" aria-label=${
this.getMsg('PLACE_RATING_ARIA_LABEL', rating!.toFixed(1))}>
<span aria-hidden="true">
<span>${rating!.toFixed(1)}</span>
${map(icons, (iconType) => {
Expand Down
4 changes: 2 additions & 2 deletions src/place_building_blocks/place_reviews/place_reviews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ export class PlaceReviews extends PlaceDataConsumer {
const subheader = html`
<div class="subheader">
${when(review.rating, () => html`
<span aria-label=${
this.getMsg('PLACE_RATING_ARIA_LABEL', review.rating!)}>
<span role="img" aria-label=${
this.getMsg('PLACE_RATING_ARIA_LABEL', review.rating!)}>
<span aria-hidden="true">
${map(toStarIcons(review.rating!), (iconType) => {
return html`<span class="star-icon ${iconType}">&#x2605;</span>`;
Expand Down

0 comments on commit 874beef

Please sign in to comment.