@affino/aria-utils
v0.1.0
Published
Dialog and overlay ARIA helpers
Readme
@affino/aria-utils
Opinionated helpers for wiring ARIA attributes on overlay surfaces.
import { ensureDialogAria } from "@affino/aria-utils"
ensureDialogAria({
surface: dialogEl,
labelId: "settings-title",
fallbackLabel: "Settings dialog",
warn: import.meta.env.DEV,
})- Ensures
role="dialog"/aria-modal="true". - Applies
aria-labelledby(oraria-labelfallback). - Finds descriptions via
[data-dialog-description]or.dialog-descriptionand wiresaria-describedby. - Emits a dev warning when no description is available.
You can customize selectors, id prefixes, and even provide your own console implementation.
