# `Bylaw.HTML.Check.RequireLinkHref`
[🔗](https://github.com/ryanzidago/bylaw/blob/v0.1.0-alpha.2/lib/bylaw/html/check/require_link_href.ex#L1)

Validates that rendered anchor tags define an `href` attribute.

This check inspects rendered `<a>` elements and flags anchors without `href`.
Use a `<button>` for actions that do not navigate.

## Examples

Bad:

    <a>Settings</a>

Why this is bad:

An anchor without `href` is not durable navigation. It is less predictable for
keyboard users, assistive technology, browser affordances, and link behavior
such as opening in a new tab or copying the target URL.

Better:

    <a href="/settings">Settings</a>

Why this is better:

The element exposes a real destination, so it behaves like a browser link.

Bad:

    <a phx-click="save">Save</a>

Why this is bad:

A click-only anchor is acting as an event control, not navigation.

Better:

    <button type="button" phx-click="save">Save</button>

Why this is better:

A button communicates that the element performs an action.

## Notes

The check only verifies that an `href` attribute is present. It allows
`href=""` and `href="#"`; use `Bylaw.HTML.Check.PreferButtonForAction` to
flag rendered action links that combine `phx-click` with placeholder hrefs.

This check runs on rendered HTML, so dynamic attributes are evaluated after
rendering. It does not report the source component or template that produced
an anchor.

## Options

This check has no check-specific options. Add the module directly to the
explicit checks list:

    Bylaw.HTML.Check.RequireLinkHref

## Usage

Add this module to the explicit check list passed through `Bylaw.HTML`.
See `Bylaw.HTML` for the full rendered HTML validation setup.

# `validate`

```elixir
@spec validate(Bylaw.HTML.Check.context()) :: Bylaw.HTML.Check.result()
```

Implements the `Bylaw.HTML.Check` validation callback.

---

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