Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add accessible label to store locator directions button #239

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading