Link

Native anchors are preferred. Custom text, image, and icon links receive link semantics and Enter activation; they do not gain native browser link context menus.

Corresponding W3C APG example

Example

Native link (preferred)

Text link on a span

Open the museum guide

You reached the link’s destination.

Keyboard interaction

Tab reaches each link. Enter follows it. Space keeps normal page-scrolling behavior. Native anchors retain their browser navigation and modifier-key behavior.

Events

Listen on the widget or delegate to <axxy-scope> or document. All custom events bubble.

  • click — Standard link activation event (including Enter key on custom links). (target: <a href> / [role="link"], detail: Native MouseEvent, cancelable)

Events reference and examples

Example HTML

<axxy-scope>
  <p>
    <a href="#link-destination">Native link (preferred)</a>
  </p>
  <p>
    <span role="link" data-href="#link-destination">Text link on a span</span>
  </p>
  <p>
    <img role="link" src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22100%22%20height%3D%2244%22%3E%3Crect%20width%3D%22100%22%20height%3D%2244%22%20rx%3D%226%22%20fill%3D%22%23004c97%22%2F%3E%3Ctext%20x%3D%2250%22%20y%3D%2229%22%20text-anchor%3D%22middle%22%20fill%3D%22white%22%20font-size%3D%2218%22%3EGuide%3C%2Ftext%3E%3C%2Fsvg%3E" alt="Open the museum guide" data-href="#link-destination" width="100" height="44">
  </p>
  <p>
    <span role="link" data-href="#link-destination" aria-label="Open the museum guide">
      <span aria-hidden="true">↗ Guide</span>
    </span>
  </p>
  <h3 id="link-destination">Museum guide</h3>
  <p>You reached the link’s destination.</p>
</axxy-scope>