Skip to content

Commit

Permalink
fix: add accessible label to store locator directions button
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 688670234
  • Loading branch information
awmack authored and copybara-github committed Oct 22, 2024
1 parent 8de2d96 commit 696ae15
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/base/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type StringFunction = (...args: any[]) => string;
export declare interface StringLiterals extends
Record<string, string|StringFunction> {
LOCATOR_BACK_BUTTON_CTA: string;
LOCATOR_DIRECTIONS_BUTTON_LABEL: (destination: string) => string;
LOCATOR_LIST_HEADER: string;
LOCATOR_LIST_SUBHEADING: string;
LOCATOR_LIST_SUBHEADING_WITH_SEARCH: string;
Expand Down Expand Up @@ -64,6 +65,8 @@ export declare interface StringLiterals extends
*/
export const STRING_LITERALS_EN_US: StringLiterals = Object.freeze({
'LOCATOR_BACK_BUTTON_CTA': 'Back',
'LOCATOR_DIRECTIONS_BUTTON_LABEL': (destination) =>
`Directions to ${destination}`,
'LOCATOR_LIST_HEADER': 'Find a location near you',
'LOCATOR_LIST_SUBHEADING': 'All locations',
'LOCATOR_LIST_SUBHEADING_WITH_SEARCH': 'Nearest locations',
Expand Down
6 changes: 4 additions & 2 deletions src/store_locator/store_locator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,10 @@ export class StoreLocator extends BaseComponent {
</gmpx-icon-button>`);
}
for (const action of listing.actions ?? []) {
actionButtons.push(html`
actionButtons.push(
html`
<gmpx-icon-button icon="open_in_new" .href=${
action.defaultUri ?? nothing}>
action.defaultUri ?? nothing}>
${action.label}
</gmpx-icon-button>`);
}
Expand Down Expand Up @@ -426,6 +427,7 @@ export class StoreLocator extends BaseComponent {
</div>
<div class="distance">${distanceHtml}</div>
<gmpx-place-directions-button condensed
.ariaLabel=${this.getMsg('LOCATOR_DIRECTIONS_BUTTON_LABEL', listing.title)}
.origin=${this.searchLocation?.location ?? undefined}>
</gmpx-place-directions-button>
</div>
Expand Down

0 comments on commit 696ae15

Please sign in to comment.