UNPKG

sicua

Version:

A tool for analyzing project structure and dependencies

76 lines (75 loc) 2.57 kB
/** * Context analyzer for accessibility validation * Analyzes surrounding elements and component context for accessibility patterns */ import { JSXElementInfo } from "../types/accessibilityTypes"; export declare class ContextAnalyzer { /** * Analyzes if a form input has proper labeling considering context */ static hasFormInputLabeling(element: JSXElementInfo, allElements: JSXElementInfo[]): boolean; /** * Checks if an input is hidden and doesn't need labeling */ private static isHiddenInput; /** * Checks for direct ARIA labeling attributes */ private static hasDirectLabeling; /** * Checks for associated label elements using htmlFor/id relationship */ private static hasAssociatedLabel; /** * Checks if element is wrapped in a label element */ private static hasParentLabel; /** * Checks for placeholder text as a fallback labeling mechanism */ private static hasPlaceholderText; /** * Checks for labeling props that might be spread or passed through */ private static hasLabelingProps; /** * Analyzes interactive elements for proper roles and labeling */ static hasInteractiveLabeling(element: JSXElementInfo): boolean; /** * Checks if element appears to be icon-only */ private static isIconOnlyElement; /** * Checks if a child element is likely an icon component */ private static isIconComponent; /** * Checks for explicit labeling required for icon-only elements */ private static hasExplicitLabeling; /** * Analyzes if a link has descriptive text considering context */ static hasDescriptiveLinkText(element: JSXElementInfo): boolean; /** * Checks if an element is within a form context */ static isInFormContext(allElements: JSXElementInfo[]): boolean; /** * Analyzes component props for accessibility patterns */ static hasAccessibilityProps(element: JSXElementInfo): boolean; /** * Checks for spread props that might contain accessibility attributes */ static hasSpreadProps(element: JSXElementInfo): boolean; /** * Determines severity level based on context analysis */ static determineSeverity(element: JSXElementInfo, hasIssue: boolean, hasPartialSupport: boolean): "error" | "warning" | "info" | null; /** * Provides context-aware suggestions for accessibility improvements */ static getSuggestions(element: JSXElementInfo): string[]; }