${this.renderRipple()} ${this.renderFocusRing()}
${this.renderBody()}
`);
}
/**
* Renders the root list item.
*
* @param content the child content of the list item.
*/
protected renderListItem(content: unknown) {
const isAnchor = this.type === 'link';
let tag: StaticValue;
switch (this.menuItemController.tagName) {
case 'a':
tag = literal`a`;
break;
case 'button':
tag = literal`button`;
break;
default:
case 'li':
tag = literal`li`;
break;
}
// TODO(b/265339866): announce "button"/"link" inside of a list item. Until
// then all are "menuitem" roles for correct announcement.
const target = isAnchor && !!this.target ? this.target : nothing;
return staticHtml`
<${tag}
id="item"
tabindex=${this.disabled && !isAnchor ? -1 : 0}
role=${this.menuItemController.role}
aria-label=${(this as ARIAMixinStrict).ariaLabel || nothing}
aria-selected=${(this as ARIAMixinStrict).ariaSelected || nothing}
aria-checked=${(this as ARIAMixinStrict).ariaChecked || nothing}
aria-expanded=${(this as ARIAMixinStrict).ariaExpanded || nothing}
aria-haspopup=${(this as ARIAMixinStrict).ariaHasPopup || nothing}
class="list-item ${classMap(this.getRenderClasses())}"
href=${this.href || nothing}
target=${target}
@click=${this.menuItemController.onClick}
@keydown=${this.menuItemController.onKeydown}
>${content}${tag}>
`;
}
/**
* Handles rendering of the ripple element.
*/
protected renderRipple(): TemplateResult | typeof nothing {
return html`