react-a11y-inspector
Version:
An advanced React accessibility inspection tool with real-time monitoring, screen reader simulation, and customizable rules.
15 lines (14 loc) • 461 B
JavaScript
export const checkFormLabels = () => {
const issues = [];
document.querySelectorAll('input, select, textarea').forEach((el) => {
if (!el.labels || el.labels.length === 0) {
issues.push({
type: 'Missing Form Label',
message: `Form element ${el.tagName} with name "${el.name}" is missing a label.`,
severity: 'Warning',
element: el,
});
}
});
return issues;
};