a11y

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package a11y defines semantic types for accessibility findings tied to WCAG success criteria and projects them into the domain-neutral findingspec.Finding.

Index

Constants

View Source
const TypeWCAG = "wcag"

TypeWCAG is the a11y finding type: a WCAG success-criterion issue. It is set as findingspec.Finding.Type by Issue.ToFinding.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConformanceLevel

type ConformanceLevel string

ConformanceLevel is a WCAG conformance level.

const (
	LevelA   ConformanceLevel = "A"
	LevelAA  ConformanceLevel = "AA"
	LevelAAA ConformanceLevel = "AAA"
)

type Detail

type Detail struct {
	Criterion string           `json:"criterion,omitempty"`
	Level     ConformanceLevel `json:"level,omitempty"`
	Impact    Impact           `json:"impact,omitempty"`
	Rule      string           `json:"rule,omitempty"`
	HelpURL   string           `json:"helpUrl,omitempty"`
}

Detail is the per-type Detail payload for an a11y finding (findingspec.Finding.Type == TypeWCAG).

type Impact

type Impact string

Impact is the user-facing impact of an accessibility issue, following the common minor/moderate/serious/critical scale used by tools such as axe-core.

const (
	ImpactMinor    Impact = "minor"
	ImpactModerate Impact = "moderate"
	ImpactSerious  Impact = "serious"
	ImpactCritical Impact = "critical"
)

func (Impact) Severity

func (i Impact) Severity() findingspec.Severity

Severity maps an accessibility Impact to the shared severity scale.

type Issue

type Issue struct {
	ID          string `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	// Criterion is the WCAG success-criterion identifier, e.g. "1.4.3".
	Criterion string `json:"criterion,omitempty"`
	// Level is the WCAG conformance level of the criterion.
	Level ConformanceLevel `json:"level,omitempty"`
	// Impact is the severity of the issue for users.
	Impact Impact `json:"impact,omitempty"`
	// HelpURL points to guidance for resolving the issue.
	HelpURL string `json:"helpUrl,omitempty"`
	// Rule is the checker's rule identifier (e.g. axe-core's "color-contrast"),
	// distinct from the WCAG criterion. Optional.
	Rule string `json:"rule,omitempty"`

	Location    *findingspec.Location    `json:"location,omitempty"`
	Remediation *findingspec.Remediation `json:"remediation,omitempty"`
	Status      findingspec.Status       `json:"status,omitempty"`
	DetectedAt  *time.Time               `json:"detectedAt,omitempty"`
}

Issue is an accessibility finding for a specific WCAG success criterion at a location in a rendered page.

func (Issue) ToFinding

func (i Issue) ToFinding() findingspec.Finding

ToFinding projects the issue into a domain-neutral findingspec.Finding in the a11y domain, mapping WCAG impact to severity and the success criterion to the finding's RuleID.

Jump to

Keyboard shortcuts

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