17 lines
543 B
TypeScript
17 lines
543 B
TypeScript
/** PettyContextMenuItem — single item within a context menu. */
|
|
export class PettyContextMenuItem extends HTMLElement {
|
|
static observedAttributes = ["disabled"];
|
|
|
|
connectedCallback(): void {
|
|
this.setAttribute("role", "menuitem");
|
|
this.setAttribute("tabindex", "-1");
|
|
if (this.hasAttribute("disabled")) this.setAttribute("aria-disabled", "true");
|
|
}
|
|
|
|
attributeChangedCallback(name: string): void {
|
|
if (name === "disabled") {
|
|
this.setAttribute("aria-disabled", String(this.hasAttribute("disabled")));
|
|
}
|
|
}
|
|
}
|