-
Notifications
You must be signed in to change notification settings - Fork 200
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(breadcrumbs): trigger change event on breadcrumbs via keyboard #4769
Conversation
Lighthouse scores
What is this?Lighthouse scores comparing the documentation site built from the PR ("Branch") to that of the production documentation site ("Latest") and the build currently on Transfer Size
Request Count
|
Pull Request Test Coverage Report for Build 11017229033Details
💛 - Coveralls |
Tachometer resultsChromebreadcrumbs permalinkbasic-test
Firefoxbreadcrumbs permalinkbasic-test
|
Would it work to handle the keydown event and trigger the same action as the click event when the pseudo-code: <breadcrumb-item @keydown=${this.handleKeyDown}>
protected handleKeyDown(event: KeyboardEvent): void {
if (event.key === 'Enter' || event.keyCode === 13) {
this.handleClick(event);
}
} |
@@ -86,7 +86,9 @@ export class BreadcrumbItem extends LikeAnchor(Focusable) { | |||
return html` | |||
<a | |||
id="item-link" | |||
href=${ifDefined(!this.isLastOfType ? this.href : undefined)} | |||
href=${ifDefined( | |||
!this.isLastOfType ? this.href || '#' : undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this lead to a jump to the top of the page when "#"
is set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I have updated the changes. Let' see if we can land this for tomorrow's release.
Description
Due to
undefined
href attribute, breadcrumb items without hrefs would not trigger change events on keyboard Enter press.I added a similar fix which is used for
sp-sidenav-item
, which is a placeholder href value.Related issue(s)
Fix for #4733
Motivation and context
How has this been tested?
Test case 1
Did it pass in Desktop?
Did it pass in Mobile? - N/A
Did it pass in iPad? - N/A
Screenshots (if appropriate)
Types of changes
Checklist
Best practices
This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against
main
.