Skip to content

Commit

Permalink
chore(breadcrumbs): attached keydown event to the breadcrumb link
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajdeep Chandra authored and Rajdeep Chandra committed Sep 24, 2024
1 parent f898e55 commit 2b01ee7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/breadcrumbs/src/BreadcrumbItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,22 @@ export class BreadcrumbItem extends LikeAnchor(Focusable) {
}
}

protected handleKeyDown(event: KeyboardEvent): void {
if (event.key === 'Enter' || event.keyCode === 13) {
this.handleClick(event);
}
}

protected renderLink(): TemplateResult {
return html`
<a
id="item-link"
href=${ifDefined(
!this.isLastOfType ? this.href || '#' : undefined
)}
href=${ifDefined(!this.isLastOfType ? this.href : undefined)}
tabindex=${0}
aria-current=${ifDefined(
this.isLastOfType ? 'page' : undefined
)}
@keydown=${this.handleKeyDown}
@click=${this.handleClick}
>
<slot></slot>
Expand Down

0 comments on commit 2b01ee7

Please sign in to comment.