# `Excessibility.LiveViewRules`
[🔗](https://github.com/lessthanseventy/excessibility/blob/v0.18.1/lib/excessibility/live_view_rules.ex#L1)

LiveView-aware accessibility rules.

Runs a set of HTML-level checks that axe-core cannot perform because
they depend on Phoenix-specific attributes (`phx-click`, `phx-submit`,
`phx-debounce`, etc.). These rules complement axe-core rather than
replace it — snapshot tests run **both** axe-core and these rules.

On non-Phoenix HTML the rules are no-ops: if no `phx-*` attributes
exist, no findings are produced.

## Usage

    {:ok, html} = File.read("snapshot.html")
    result = Excessibility.LiveViewRules.scan(html)

    for finding <- result.findings do
      IO.puts("[#{finding.severity}] #{finding.rule}: #{finding.message}")
    end

## Options

  * `:disable` — list of rule ids to skip (default `[]`)
  * `:only` — if given, run only these rule ids (overrides `:disable`)

## Adding custom rules

Register application-level rule modules via config:

    config :excessibility, custom_live_view_rules: [MyApp.Rules.CustomRule]

See `Excessibility.LiveViewRules.Rule` for the behaviour.

# `result`

```elixir
@type result() :: %{
  findings: [Excessibility.LiveViewRules.Rule.finding()],
  rules_run: [atom()]
}
```

The aggregate result of a LiveView rule scan.

# `rules`

```elixir
@spec rules() :: [module()]
```

Returns all registered rule modules (built-in + custom via config).

# `scan`

```elixir
@spec scan(
  String.t(),
  keyword()
) :: result()
```

Scan an HTML string and return findings from all enabled rules.

Returns `%{findings: [...], rules_run: [rule_id, ...]}`. On a parse
failure returns `%{findings: [], rules_run: []}`.

# `scan_file`

```elixir
@spec scan_file(
  Path.t(),
  keyword()
) :: result()
```

Like `scan/2`, but reads HTML from a file path.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
