Merge pull request #5758 from vdegenne:list-item-click

PiperOrigin-RevId: 721086401
This commit is contained in:
Copybara-Service 2025-01-29 13:21:06 -08:00
commit ac916578a2

View File

@ -203,4 +203,16 @@ export class ListItemEl extends listItemBaseClass implements ListItem {
// work programmatically like in FF and select-option
this.listItemRoot?.focus();
}
override click() {
if (!this.listItemRoot) {
// If the element has not finished rendering, call super to ensure click
// events are dispatched.
super.click();
return;
}
// Forward click to the element to ensure link <a>.click() works correctly.
this.listItemRoot.click();
}
}