src/lib/form/extractors/strategies/aria-label.ts
Symbols by Kind
method
1
All Symbols
| Name | Kind | Visibility | Status | Lines | Signature |
|---|---|---|---|---|---|
| find | method | - | 11-15 | find(element: HTMLElement): : LabelResult | null |
Full Source
/**
* Label Strategy — aria-label
*
* Reads the WAI-ARIA `aria-label` attribute.
*/
import type { LabelResult, LabelStrategy } from "../label-strategy.interface";
export const ariaLabelStrategy: LabelStrategy = {
name: "aria-label",
find(element: HTMLElement): LabelResult | null {
const ariaLabel = element.getAttribute("aria-label");
const text = ariaLabel?.trim();
return text ? { text, strategy: "aria-label" } : null;
},
};