@markuplint/ml-spec
Version:
Types and schema that specs of the Markup languages for markuplint
12 lines (11 loc) • 371 B
JavaScript
// @ts-ignore
import { computeAccessibleName } from 'dom-accessibility-api';
export function getAccname(
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
el) {
const name = computeAccessibleName(el);
if (!name.trim() && el.nodeName === 'INPUT') {
return el.getAttribute('placeholder')?.trim() ?? '';
}
return name;
}