UNPKG

@material/web

Version:
38 lines (37 loc) 1.08 kB
/** * @license * Copyright 2023 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import { ReactiveElement } from 'lit'; /** * Sets up a `ReactiveElement` constructor to enable updates when delegating * aria attributes. Elements may bind `this.aria*` properties to `aria-*` * attributes in their render functions. * * This function will: * - Call `requestUpdate()` when an aria attribute changes. * - Add `role="presentation"` to the host. * * NOTE: The following features are not currently supported: * - Delegating IDREF attributes (ex: `aria-labelledby`, `aria-controls`) * - Delegating the `role` attribute * * @example * class XButton extends LitElement { * static { * requestUpdateOnAriaChange(XButton); * } * * protected override render() { * return html` * <button aria-label=${this.ariaLabel || nothing}> * <slot></slot> * </button> * `; * } * } * * @param ctor The `ReactiveElement` constructor to patch. */ export declare function requestUpdateOnAriaChange(ctor: typeof ReactiveElement): void;