wcag

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package wcag provides WCAG 2.2 criteria definitions and evaluation methods.

Package wcag provides WCAG accessibility testing rules.

Index

Constants

This section is empty.

Variables

View Source
var WCAG22AA = []Criterion{

	{ID: "1.1.1", Name: "Non-text Content", Level: "A", Principle: "Perceivable", Guideline: "Text Alternatives",
		Description: "All non-text content has a text alternative that serves the equivalent purpose.",
		Method:      MethodHybrid, AxeRules: []string{"image-alt", "input-image-alt", "area-alt", "object-alt", "svg-img-alt"}},

	{ID: "1.2.1", Name: "Audio-only and Video-only (Prerecorded)", Level: "A", Principle: "Perceivable", Guideline: "Time-based Media",
		Description: "Prerecorded audio-only and video-only media have alternatives.",
		Method:      MethodLLMJudge},
	{ID: "1.2.2", Name: "Captions (Prerecorded)", Level: "A", Principle: "Perceivable", Guideline: "Time-based Media",
		Description: "Captions are provided for all prerecorded audio content in synchronized media.",
		Method:      MethodHybrid, AxeRules: []string{"video-caption"}},
	{ID: "1.2.3", Name: "Audio Description or Media Alternative (Prerecorded)", Level: "A", Principle: "Perceivable", Guideline: "Time-based Media",
		Description: "An alternative for time-based media or audio description is provided.",
		Method:      MethodLLMJudge},
	{ID: "1.2.4", Name: "Captions (Live)", Level: "AA", Principle: "Perceivable", Guideline: "Time-based Media",
		Description: "Captions are provided for all live audio content in synchronized media.",
		Method:      MethodSpecialized},
	{ID: "1.2.5", Name: "Audio Description (Prerecorded)", Level: "AA", Principle: "Perceivable", Guideline: "Time-based Media",
		Description: "Audio description is provided for all prerecorded video content.",
		Method:      MethodLLMJudge},

	{ID: "1.3.1", Name: "Info and Relationships", Level: "A", Principle: "Perceivable", Guideline: "Adaptable",
		Description: "Information, structure, and relationships conveyed through presentation can be programmatically determined.",
		Method:      MethodAutomated, AxeRules: []string{"definition-list", "dlitem", "list", "listitem", "table-duplicate-name", "td-headers-attr", "th-has-data-cells"}},
	{ID: "1.3.2", Name: "Meaningful Sequence", Level: "A", Principle: "Perceivable", Guideline: "Adaptable",
		Description: "Correct reading sequence can be programmatically determined when sequence affects meaning.",
		Method:      MethodLLMJudge},
	{ID: "1.3.3", Name: "Sensory Characteristics", Level: "A", Principle: "Perceivable", Guideline: "Adaptable",
		Description: "Instructions do not rely solely on sensory characteristics of components.",
		Method:      MethodLLMJudge},
	{ID: "1.3.4", Name: "Orientation", Level: "AA", Principle: "Perceivable", Guideline: "Adaptable",
		Description: "Content does not restrict view and operation to a single display orientation.",
		Method:      MethodAutomated, AxeRules: []string{"css-orientation-lock"}},
	{ID: "1.3.5", Name: "Identify Input Purpose", Level: "AA", Principle: "Perceivable", Guideline: "Adaptable",
		Description: "Input fields collecting user information have programmatically determinable purpose.",
		Method:      MethodAutomated, AxeRules: []string{"autocomplete-valid"}},

	{ID: "1.4.1", Name: "Use of Color", Level: "A", Principle: "Perceivable", Guideline: "Distinguishable",
		Description: "Color is not the only visual means of conveying information.",
		Method:      MethodLLMJudge, AxeRules: []string{"link-in-text-block"}},
	{ID: "1.4.2", Name: "Audio Control", Level: "A", Principle: "Perceivable", Guideline: "Distinguishable",
		Description: "Mechanism to pause, stop, or control volume of audio that plays automatically.",
		Method:      MethodSpecialized, AxeRules: []string{"no-autoplay-audio"}},
	{ID: "1.4.3", Name: "Contrast (Minimum)", Level: "AA", Principle: "Perceivable", Guideline: "Distinguishable",
		Description: "Text has a contrast ratio of at least 4.5:1 (3:1 for large text).",
		Method:      MethodAutomated, AxeRules: []string{"color-contrast"}},
	{ID: "1.4.4", Name: "Resize Text", Level: "AA", Principle: "Perceivable", Guideline: "Distinguishable",
		Description: "Text can be resized up to 200% without loss of content or functionality.",
		Method:      MethodSpecialized, AxeRules: []string{"meta-viewport"}},
	{ID: "1.4.5", Name: "Images of Text", Level: "AA", Principle: "Perceivable", Guideline: "Distinguishable",
		Description: "If technologies can achieve visual presentation, text is used rather than images of text.",
		Method:      MethodLLMJudge},
	{ID: "1.4.10", Name: "Reflow", Level: "AA", Principle: "Perceivable", Guideline: "Distinguishable",
		Description: "Content reflows without requiring scrolling in two dimensions at 320 CSS pixels.",
		Method:      MethodSpecialized},
	{ID: "1.4.11", Name: "Non-text Contrast", Level: "AA", Principle: "Perceivable", Guideline: "Distinguishable",
		Description: "UI components and graphical objects have a contrast ratio of at least 3:1.",
		Method:      MethodAutomated, AxeRules: []string{"color-contrast-enhanced"}},
	{ID: "1.4.12", Name: "Text Spacing", Level: "AA", Principle: "Perceivable", Guideline: "Distinguishable",
		Description: "No loss of content when text spacing is adjusted within WCAG requirements.",
		Method:      MethodSpecialized},
	{ID: "1.4.13", Name: "Content on Hover or Focus", Level: "AA", Principle: "Perceivable", Guideline: "Distinguishable",
		Description: "Additional content triggered by hover/focus can be dismissed, hovered, and is persistent.",
		Method:      MethodSpecialized},

	{ID: "2.1.1", Name: "Keyboard", Level: "A", Principle: "Operable", Guideline: "Keyboard Accessible",
		Description: "All functionality is operable through a keyboard interface.",
		Method:      MethodSpecialized, AxeRules: []string{"scrollable-region-focusable"}},
	{ID: "2.1.2", Name: "No Keyboard Trap", Level: "A", Principle: "Operable", Guideline: "Keyboard Accessible",
		Description: "Keyboard focus can be moved away from any component using only a keyboard.",
		Method:      MethodSpecialized},
	{ID: "2.1.4", Name: "Character Key Shortcuts", Level: "A", Principle: "Operable", Guideline: "Keyboard Accessible",
		Description: "Single character key shortcuts can be turned off, remapped, or activated only on focus.",
		Method:      MethodSpecialized},

	{ID: "2.2.1", Name: "Timing Adjustable", Level: "A", Principle: "Operable", Guideline: "Enough Time",
		Description: "Users can turn off, adjust, or extend time limits.",
		Method:      MethodSpecialized, AxeRules: []string{"meta-refresh"}},
	{ID: "2.2.2", Name: "Pause, Stop, Hide", Level: "A", Principle: "Operable", Guideline: "Enough Time",
		Description: "Moving, blinking, scrolling, or auto-updating content can be paused, stopped, or hidden.",
		Method:      MethodSpecialized, AxeRules: []string{"blink", "marquee"}},

	{ID: "2.3.1", Name: "Three Flashes or Below Threshold", Level: "A", Principle: "Operable", Guideline: "Seizures",
		Description: "Content does not contain anything that flashes more than three times in one second.",
		Method:      MethodSpecialized},

	{ID: "2.4.1", Name: "Bypass Blocks", Level: "A", Principle: "Operable", Guideline: "Navigable",
		Description: "A mechanism is available to bypass blocks of content repeated on multiple pages.",
		Method:      MethodAutomated, AxeRules: []string{"bypass", "skip-link"}},
	{ID: "2.4.2", Name: "Page Titled", Level: "A", Principle: "Operable", Guideline: "Navigable",
		Description: "Web pages have titles that describe topic or purpose.",
		Method:      MethodAutomated, AxeRules: []string{"document-title"}},
	{ID: "2.4.3", Name: "Focus Order", Level: "A", Principle: "Operable", Guideline: "Navigable",
		Description: "Focusable components receive focus in a sequence that preserves meaning.",
		Method:      MethodSpecialized, AxeRules: []string{"tabindex"}},
	{ID: "2.4.4", Name: "Link Purpose (In Context)", Level: "A", Principle: "Operable", Guideline: "Navigable",
		Description: "Link purpose can be determined from link text or its context.",
		Method:      MethodLLMJudge, AxeRules: []string{"link-name"}},
	{ID: "2.4.5", Name: "Multiple Ways", Level: "AA", Principle: "Operable", Guideline: "Navigable",
		Description: "More than one way to locate a page within a set of pages.",
		Method:      MethodLLMJudge},
	{ID: "2.4.6", Name: "Headings and Labels", Level: "AA", Principle: "Operable", Guideline: "Navigable",
		Description: "Headings and labels describe topic or purpose.",
		Method:      MethodLLMJudge, AxeRules: []string{"empty-heading"}},
	{ID: "2.4.7", Name: "Focus Visible", Level: "AA", Principle: "Operable", Guideline: "Navigable",
		Description: "Keyboard focus indicator is visible.",
		Method:      MethodSpecialized},
	{ID: "2.4.11", Name: "Focus Not Obscured (Minimum)", Level: "AA", Principle: "Operable", Guideline: "Navigable",
		Description: "Focused component is not entirely hidden by author-created content.",
		Method:      MethodSpecialized},

	{ID: "2.5.1", Name: "Pointer Gestures", Level: "A", Principle: "Operable", Guideline: "Input Modalities",
		Description: "All functionality using multipoint/path-based gestures can be operated with single pointer.",
		Method:      MethodSpecialized},
	{ID: "2.5.2", Name: "Pointer Cancellation", Level: "A", Principle: "Operable", Guideline: "Input Modalities",
		Description: "Functions triggered by single pointer can be cancelled.",
		Method:      MethodSpecialized},
	{ID: "2.5.3", Name: "Label in Name", Level: "A", Principle: "Operable", Guideline: "Input Modalities",
		Description: "Visible text label is contained in accessible name.",
		Method:      MethodAutomated, AxeRules: []string{"label-content-name-mismatch"}},
	{ID: "2.5.4", Name: "Motion Actuation", Level: "A", Principle: "Operable", Guideline: "Input Modalities",
		Description: "Functions operable by device motion can be operated by UI and motion can be disabled.",
		Method:      MethodSpecialized},
	{ID: "2.5.7", Name: "Dragging Movements", Level: "AA", Principle: "Operable", Guideline: "Input Modalities",
		Description: "Functionality using dragging can be achieved by single pointer without dragging.",
		Method:      MethodLLMJudge},
	{ID: "2.5.8", Name: "Target Size (Minimum)", Level: "AA", Principle: "Operable", Guideline: "Input Modalities",
		Description: "Target size for pointer inputs is at least 24x24 CSS pixels.",
		Method:      MethodSpecialized},

	{ID: "3.1.1", Name: "Language of Page", Level: "A", Principle: "Understandable", Guideline: "Readable",
		Description: "Default human language of each page can be programmatically determined.",
		Method:      MethodAutomated, AxeRules: []string{"html-has-lang", "html-lang-valid"}},
	{ID: "3.1.2", Name: "Language of Parts", Level: "AA", Principle: "Understandable", Guideline: "Readable",
		Description: "Language of each passage or phrase can be programmatically determined.",
		Method:      MethodAutomated, AxeRules: []string{"valid-lang"}},

	{ID: "3.2.1", Name: "On Focus", Level: "A", Principle: "Understandable", Guideline: "Predictable",
		Description: "Receiving focus does not initiate a change of context.",
		Method:      MethodSpecialized},
	{ID: "3.2.2", Name: "On Input", Level: "A", Principle: "Understandable", Guideline: "Predictable",
		Description: "Changing a UI component does not automatically cause a change of context.",
		Method:      MethodSpecialized, AxeRules: []string{"select-name"}},
	{ID: "3.2.3", Name: "Consistent Navigation", Level: "AA", Principle: "Understandable", Guideline: "Predictable",
		Description: "Navigation mechanisms that appear on multiple pages occur in the same relative order.",
		Method:      MethodLLMJudge},
	{ID: "3.2.4", Name: "Consistent Identification", Level: "AA", Principle: "Understandable", Guideline: "Predictable",
		Description: "Components with same functionality within a set of pages are identified consistently.",
		Method:      MethodLLMJudge},
	{ID: "3.2.6", Name: "Consistent Help", Level: "A", Principle: "Understandable", Guideline: "Predictable",
		Description: "Help mechanisms occur in same relative order across pages.",
		Method:      MethodLLMJudge},

	{ID: "3.3.1", Name: "Error Identification", Level: "A", Principle: "Understandable", Guideline: "Input Assistance",
		Description: "If an input error is detected, the item and error are described in text.",
		Method:      MethodLLMJudge},
	{ID: "3.3.2", Name: "Labels or Instructions", Level: "A", Principle: "Understandable", Guideline: "Input Assistance",
		Description: "Labels or instructions are provided when content requires user input.",
		Method:      MethodAutomated, AxeRules: []string{"label", "form-field-multiple-labels"}},
	{ID: "3.3.3", Name: "Error Suggestion", Level: "AA", Principle: "Understandable", Guideline: "Input Assistance",
		Description: "If an input error is detected, suggestions are provided.",
		Method:      MethodLLMJudge},
	{ID: "3.3.4", Name: "Error Prevention (Legal, Financial, Data)", Level: "AA", Principle: "Understandable", Guideline: "Input Assistance",
		Description: "Submissions that cause legal commitments can be reversed, checked, or confirmed.",
		Method:      MethodLLMJudge},
	{ID: "3.3.7", Name: "Redundant Entry", Level: "A", Principle: "Understandable", Guideline: "Input Assistance",
		Description: "Information previously entered is auto-populated or available for selection.",
		Method:      MethodSpecialized},
	{ID: "3.3.8", Name: "Accessible Authentication (Minimum)", Level: "AA", Principle: "Understandable", Guideline: "Input Assistance",
		Description: "Cognitive function test is not required for authentication unless alternative provided.",
		Method:      MethodLLMJudge},

	{ID: "4.1.2", Name: "Name, Role, Value", Level: "A", Principle: "Robust", Guideline: "Compatible",
		Description: "Name and role can be programmatically determined; states and values can be set programmatically.",
		Method:      MethodAutomated, AxeRules: []string{"aria-allowed-attr", "aria-hidden-body", "aria-required-attr", "aria-roles", "aria-valid-attr-value", "aria-valid-attr", "button-name", "input-button-name", "role-img-alt"}},
	{ID: "4.1.3", Name: "Status Messages", Level: "AA", Principle: "Robust", Guideline: "Compatible",
		Description: "Status messages can be programmatically determined through role or properties.",
		Method:      MethodAutomated, AxeRules: []string{"aria-live-region-text"}},
}

WCAG22AA contains all 50 WCAG 2.2 Level A and AA success criteria.

Functions

func MethodCounts

func MethodCounts() map[EvaluationMethod]int

MethodCounts returns the count of criteria by evaluation method.

func TotalCriteria

func TotalCriteria() int

TotalCriteria returns the total number of WCAG 2.2 AA criteria.

Types

type AriaLabelRule

type AriaLabelRule struct{ BaseRule }

func (*AriaLabelRule) Description

func (r *AriaLabelRule) Description() string

func (*AriaLabelRule) ID

func (r *AriaLabelRule) ID() string

func (*AriaLabelRule) Level

func (r *AriaLabelRule) Level() types.WCAGLevel

func (*AriaLabelRule) Name

func (r *AriaLabelRule) Name() string

func (*AriaLabelRule) Run

func (r *AriaLabelRule) Run(ctx context.Context, vibe *vibium.Vibe) ([]types.Finding, error)

func (*AriaLabelRule) SuccessCriteria

func (r *AriaLabelRule) SuccessCriteria() []string

type BaseRule

type BaseRule struct {
	// contains filtered or unexported fields
}

BaseRule provides common rule functionality.

func (*BaseRule) Description

func (r *BaseRule) Description() string

func (*BaseRule) ID

func (r *BaseRule) ID() string

func (*BaseRule) Level

func (r *BaseRule) Level() types.WCAGLevel

func (*BaseRule) Name

func (r *BaseRule) Name() string

func (*BaseRule) SuccessCriteria

func (r *BaseRule) SuccessCriteria() []string

type ButtonNameRule

type ButtonNameRule struct{ BaseRule }

func (*ButtonNameRule) Description

func (r *ButtonNameRule) Description() string

func (*ButtonNameRule) ID

func (r *ButtonNameRule) ID() string

func (*ButtonNameRule) Level

func (r *ButtonNameRule) Level() types.WCAGLevel

func (*ButtonNameRule) Name

func (r *ButtonNameRule) Name() string

func (*ButtonNameRule) Run

func (r *ButtonNameRule) Run(ctx context.Context, vibe *vibium.Vibe) ([]types.Finding, error)

func (*ButtonNameRule) SuccessCriteria

func (r *ButtonNameRule) SuccessCriteria() []string

type Conformance

type Conformance string

Conformance represents the conformance level for a criterion.

const (
	ConformanceSupports          Conformance = "Supports"
	ConformancePartiallySupports Conformance = "Partially Supports"
	ConformanceDoesNotSupport    Conformance = "Does Not Support"
	ConformanceNotApplicable     Conformance = "Not Applicable"
	ConformanceNotEvaluated      Conformance = "Not Evaluated"
)

type ContrastRule

type ContrastRule struct{ BaseRule }

ContrastRule checks color contrast.

func (*ContrastRule) Description

func (r *ContrastRule) Description() string

func (*ContrastRule) ID

func (r *ContrastRule) ID() string

func (*ContrastRule) Level

func (r *ContrastRule) Level() types.WCAGLevel

func (*ContrastRule) Name

func (r *ContrastRule) Name() string

func (*ContrastRule) Run

func (r *ContrastRule) Run(ctx context.Context, vibe *vibium.Vibe) ([]types.Finding, error)

func (*ContrastRule) SuccessCriteria

func (r *ContrastRule) SuccessCriteria() []string

type Criterion

type Criterion struct {
	ID          string           `json:"id"`
	Name        string           `json:"name"`
	Level       string           `json:"level"`
	Principle   string           `json:"principle"`
	Guideline   string           `json:"guideline"`
	Description string           `json:"description"`
	Method      EvaluationMethod `json:"method"`
	AxeRules    []string         `json:"axeRules,omitempty"`
}

Criterion defines a WCAG success criterion.

func GetCriteriaByLevel

func GetCriteriaByLevel(level string) []Criterion

GetCriteriaByLevel returns criteria filtered by WCAG level.

func GetCriteriaByMethod

func GetCriteriaByMethod(method EvaluationMethod) []Criterion

GetCriteriaByMethod returns criteria filtered by evaluation method.

func GetCriterion

func GetCriterion(id string) *Criterion

GetCriterion returns a criterion by ID.

type DescriptiveHeadingRule

type DescriptiveHeadingRule struct{ BaseRule }

func (*DescriptiveHeadingRule) Description

func (r *DescriptiveHeadingRule) Description() string

func (*DescriptiveHeadingRule) ID

func (*DescriptiveHeadingRule) Level

func (*DescriptiveHeadingRule) Name

func (r *DescriptiveHeadingRule) Name() string

func (*DescriptiveHeadingRule) Run

func (*DescriptiveHeadingRule) SuccessCriteria

func (r *DescriptiveHeadingRule) SuccessCriteria() []string

type DuplicateIDRule

type DuplicateIDRule struct{ BaseRule }

func (*DuplicateIDRule) Description

func (r *DuplicateIDRule) Description() string

func (*DuplicateIDRule) ID

func (r *DuplicateIDRule) ID() string

func (*DuplicateIDRule) Level

func (r *DuplicateIDRule) Level() types.WCAGLevel

func (*DuplicateIDRule) Name

func (r *DuplicateIDRule) Name() string

func (*DuplicateIDRule) Run

func (r *DuplicateIDRule) Run(ctx context.Context, vibe *vibium.Vibe) ([]types.Finding, error)

func (*DuplicateIDRule) SuccessCriteria

func (r *DuplicateIDRule) SuccessCriteria() []string

type EvaluationMethod

type EvaluationMethod string

EvaluationMethod indicates how a criterion is evaluated.

const (
	// MethodAutomated uses deterministic automated testing (axe-core).
	MethodAutomated EvaluationMethod = "Automated"

	// MethodSpecialized uses specialized automation (keyboard, focus, reflow).
	MethodSpecialized EvaluationMethod = "Specialized"

	// MethodLLMJudge uses LLM-as-a-Judge for semantic evaluation.
	MethodLLMJudge EvaluationMethod = "LLM-Judge"

	// MethodHybrid combines multiple methods.
	MethodHybrid EvaluationMethod = "Hybrid"

	// MethodManual requires human evaluation.
	MethodManual EvaluationMethod = "Manual"
)

type FocusVisibleRule

type FocusVisibleRule struct{ BaseRule }

func (*FocusVisibleRule) Description

func (r *FocusVisibleRule) Description() string

func (*FocusVisibleRule) ID

func (r *FocusVisibleRule) ID() string

func (*FocusVisibleRule) Level

func (r *FocusVisibleRule) Level() types.WCAGLevel

func (*FocusVisibleRule) Name

func (r *FocusVisibleRule) Name() string

func (*FocusVisibleRule) Run

func (r *FocusVisibleRule) Run(ctx context.Context, vibe *vibium.Vibe) ([]types.Finding, error)

func (*FocusVisibleRule) SuccessCriteria

func (r *FocusVisibleRule) SuccessCriteria() []string

type FormInputNameRule

type FormInputNameRule struct{ BaseRule }

func (*FormInputNameRule) Description

func (r *FormInputNameRule) Description() string

func (*FormInputNameRule) ID

func (r *FormInputNameRule) ID() string

func (*FormInputNameRule) Level

func (r *FormInputNameRule) Level() types.WCAGLevel

func (*FormInputNameRule) Name

func (r *FormInputNameRule) Name() string

func (*FormInputNameRule) Run

func (r *FormInputNameRule) Run(ctx context.Context, vibe *vibium.Vibe) ([]types.Finding, error)

func (*FormInputNameRule) SuccessCriteria

func (r *FormInputNameRule) SuccessCriteria() []string

type FormLabelRule

type FormLabelRule struct{ BaseRule }

FormLabelRule checks that form inputs have labels.

func (*FormLabelRule) Description

func (r *FormLabelRule) Description() string

func (*FormLabelRule) ID

func (r *FormLabelRule) ID() string

func (*FormLabelRule) Level

func (r *FormLabelRule) Level() types.WCAGLevel

func (*FormLabelRule) Name

func (r *FormLabelRule) Name() string

func (*FormLabelRule) Run

func (r *FormLabelRule) Run(ctx context.Context, vibe *vibium.Vibe) ([]types.Finding, error)

func (*FormLabelRule) SuccessCriteria

func (r *FormLabelRule) SuccessCriteria() []string

type HeadingStructureRule

type HeadingStructureRule struct{ BaseRule }

HeadingStructureRule checks heading hierarchy.

func (*HeadingStructureRule) Description

func (r *HeadingStructureRule) Description() string

func (*HeadingStructureRule) ID

func (r *HeadingStructureRule) ID() string

func (*HeadingStructureRule) Level

func (*HeadingStructureRule) Name

func (r *HeadingStructureRule) Name() string

func (*HeadingStructureRule) Run

func (*HeadingStructureRule) SuccessCriteria

func (r *HeadingStructureRule) SuccessCriteria() []string

type ImageAltRule

type ImageAltRule struct {
	BaseRule
}

ImageAltRule checks for missing alt text on images.

func (*ImageAltRule) Description

func (r *ImageAltRule) Description() string

func (*ImageAltRule) ID

func (r *ImageAltRule) ID() string

func (*ImageAltRule) Level

func (r *ImageAltRule) Level() types.WCAGLevel

func (*ImageAltRule) Name

func (r *ImageAltRule) Name() string

func (*ImageAltRule) Run

func (r *ImageAltRule) Run(ctx context.Context, vibe *vibium.Vibe) ([]types.Finding, error)

func (*ImageAltRule) SuccessCriteria

func (r *ImageAltRule) SuccessCriteria() []string

type ImageButtonAltRule

type ImageButtonAltRule struct{ BaseRule }

ImageButtonAltRule checks for missing alt text on image buttons.

func (*ImageButtonAltRule) Description

func (r *ImageButtonAltRule) Description() string

func (*ImageButtonAltRule) ID

func (r *ImageButtonAltRule) ID() string

func (*ImageButtonAltRule) Level

func (r *ImageButtonAltRule) Level() types.WCAGLevel

func (*ImageButtonAltRule) Name

func (r *ImageButtonAltRule) Name() string

func (*ImageButtonAltRule) Run

func (r *ImageButtonAltRule) Run(ctx context.Context, vibe *vibium.Vibe) ([]types.Finding, error)

func (*ImageButtonAltRule) SuccessCriteria

func (r *ImageButtonAltRule) SuccessCriteria() []string

type KeyboardAccessRule

type KeyboardAccessRule struct{ BaseRule }

func (*KeyboardAccessRule) Description

func (r *KeyboardAccessRule) Description() string

func (*KeyboardAccessRule) ID

func (r *KeyboardAccessRule) ID() string

func (*KeyboardAccessRule) Level

func (r *KeyboardAccessRule) Level() types.WCAGLevel

func (*KeyboardAccessRule) Name

func (r *KeyboardAccessRule) Name() string

func (*KeyboardAccessRule) Run

func (r *KeyboardAccessRule) Run(ctx context.Context, vibe *vibium.Vibe) ([]types.Finding, error)

func (*KeyboardAccessRule) SuccessCriteria

func (r *KeyboardAccessRule) SuccessCriteria() []string

type LandmarkRule

type LandmarkRule struct{ BaseRule }

LandmarkRule checks for ARIA landmarks.

func (*LandmarkRule) Description

func (r *LandmarkRule) Description() string

func (*LandmarkRule) ID

func (r *LandmarkRule) ID() string

func (*LandmarkRule) Level

func (r *LandmarkRule) Level() types.WCAGLevel

func (*LandmarkRule) Name

func (r *LandmarkRule) Name() string

func (*LandmarkRule) Run

func (r *LandmarkRule) Run(ctx context.Context, vibe *vibium.Vibe) ([]types.Finding, error)

func (*LandmarkRule) SuccessCriteria

func (r *LandmarkRule) SuccessCriteria() []string

type LanguageRule

type LanguageRule struct{ BaseRule }

func (*LanguageRule) Description

func (r *LanguageRule) Description() string

func (*LanguageRule) ID

func (r *LanguageRule) ID() string

func (*LanguageRule) Level

func (r *LanguageRule) Level() types.WCAGLevel

func (*LanguageRule) Name

func (r *LanguageRule) Name() string

func (*LanguageRule) Run

func (r *LanguageRule) Run(ctx context.Context, vibe *vibium.Vibe) ([]types.Finding, error)

func (*LanguageRule) SuccessCriteria

func (r *LanguageRule) SuccessCriteria() []string

type LinkDistinguishableRule

type LinkDistinguishableRule struct{ BaseRule }

func (*LinkDistinguishableRule) Description

func (r *LinkDistinguishableRule) Description() string

func (*LinkDistinguishableRule) ID

func (*LinkDistinguishableRule) Level

func (*LinkDistinguishableRule) Name

func (r *LinkDistinguishableRule) Name() string

func (*LinkDistinguishableRule) Run

func (*LinkDistinguishableRule) SuccessCriteria

func (r *LinkDistinguishableRule) SuccessCriteria() []string

type LinkPurposeRule

type LinkPurposeRule struct{ BaseRule }

func (*LinkPurposeRule) Description

func (r *LinkPurposeRule) Description() string

func (*LinkPurposeRule) ID

func (r *LinkPurposeRule) ID() string

func (*LinkPurposeRule) Level

func (r *LinkPurposeRule) Level() types.WCAGLevel

func (*LinkPurposeRule) Name

func (r *LinkPurposeRule) Name() string

func (*LinkPurposeRule) Run

func (r *LinkPurposeRule) Run(ctx context.Context, vibe *vibium.Vibe) ([]types.Finding, error)

func (*LinkPurposeRule) SuccessCriteria

func (r *LinkPurposeRule) SuccessCriteria() []string

type PageTitleRule

type PageTitleRule struct{ BaseRule }

func (*PageTitleRule) Description

func (r *PageTitleRule) Description() string

func (*PageTitleRule) ID

func (r *PageTitleRule) ID() string

func (*PageTitleRule) Level

func (r *PageTitleRule) Level() types.WCAGLevel

func (*PageTitleRule) Name

func (r *PageTitleRule) Name() string

func (*PageTitleRule) Run

func (r *PageTitleRule) Run(ctx context.Context, vibe *vibium.Vibe) ([]types.Finding, error)

func (*PageTitleRule) SuccessCriteria

func (r *PageTitleRule) SuccessCriteria() []string

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry holds all available rules.

func NewRegistry

func NewRegistry(logger *slog.Logger) *Registry

NewRegistry creates a new rule registry with all built-in rules.

func (*Registry) All

func (r *Registry) All() []Rule

All returns all registered rules.

func (*Registry) Get

func (r *Registry) Get(id string) (Rule, bool)

Get returns a rule by ID.

func (*Registry) GetByCriterion

func (r *Registry) GetByCriterion(criterion string) []Rule

GetByCriterion returns all rules that test a specific success criterion.

func (*Registry) GetByLevel

func (r *Registry) GetByLevel(level types.WCAGLevel) []Rule

GetByLevel returns all rules for a specific WCAG level.

func (*Registry) Register

func (r *Registry) Register(rule Rule)

Register adds a rule to the registry.

type Rule

type Rule interface {
	// ID returns the rule identifier
	ID() string

	// Name returns a human-readable name
	Name() string

	// Description returns the rule description
	Description() string

	// SuccessCriteria returns the WCAG success criteria this rule tests
	SuccessCriteria() []string

	// Level returns the WCAG level (A, AA, AAA)
	Level() types.WCAGLevel

	// Run executes the rule and returns findings
	Run(ctx context.Context, vibe *vibium.Vibe) ([]types.Finding, error)
}

Rule represents a WCAG accessibility test rule.

type Rules

type Rules struct {
	// contains filtered or unexported fields
}

Rules provides a simplified interface for running WCAG accessibility rules.

func NewRules

func NewRules(vibe *vibium.Vibe, logger *slog.Logger) *Rules

NewRules creates a new Rules instance with all built-in rules.

func (*Rules) RunAll

func (r *Rules) RunAll(ctx context.Context, level string) ([]types.Finding, error)

RunAll runs all rules for the specified WCAG level and returns findings.

type SkipLinkRule

type SkipLinkRule struct{ BaseRule }

func (*SkipLinkRule) Description

func (r *SkipLinkRule) Description() string

func (*SkipLinkRule) ID

func (r *SkipLinkRule) ID() string

func (*SkipLinkRule) Level

func (r *SkipLinkRule) Level() types.WCAGLevel

func (*SkipLinkRule) Name

func (r *SkipLinkRule) Name() string

func (*SkipLinkRule) Run

func (r *SkipLinkRule) Run(ctx context.Context, vibe *vibium.Vibe) ([]types.Finding, error)

func (*SkipLinkRule) SuccessCriteria

func (r *SkipLinkRule) SuccessCriteria() []string

type TableHeaderRule

type TableHeaderRule struct{ BaseRule }

TableHeaderRule checks that tables have headers.

func (*TableHeaderRule) Description

func (r *TableHeaderRule) Description() string

func (*TableHeaderRule) ID

func (r *TableHeaderRule) ID() string

func (*TableHeaderRule) Level

func (r *TableHeaderRule) Level() types.WCAGLevel

func (*TableHeaderRule) Name

func (r *TableHeaderRule) Name() string

func (*TableHeaderRule) Run

func (r *TableHeaderRule) Run(ctx context.Context, vibe *vibium.Vibe) ([]types.Finding, error)

func (*TableHeaderRule) SuccessCriteria

func (r *TableHeaderRule) SuccessCriteria() []string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL