# `Plushie.Automation.Element`
[🔗](https://github.com/plushie-ui/plushie-elixir/blob/v0.7.2/lib/plushie/automation/element.ex#L1)

Represents a widget element found in the UI tree during automation.

Created by `find/2` and used for scoped assertions, automation flows, and
runtime inspection. Contains the widget's ID, type, props, and children.

# `t`

```elixir
@type t() :: %Plushie.Automation.Element{
  children: [t()],
  id: String.t(),
  props: map(),
  type: String.t()
}
```

# `a11y`

```elixir
@spec a11y(element :: t()) :: map() | nil
```

Returns the a11y props map from the element, or nil if not set.

# `from_node`

```elixir
@spec from_node(node :: map()) :: t()
```

Creates an Element from a ui_node map (%{id, type, props, children}).

# `inferred_role`

```elixir
@spec inferred_role(element :: t()) :: String.t()
```

Returns the accessibility role for this element.

Reads the role from the element's a11y props first. Falls back
to inferring from the widget type for elements without a11y
(e.g., manually constructed Elements in tests).

# `resolved_a11y`

```elixir
@spec resolved_a11y(element :: t()) :: map()
```

Returns the resolved accessibility map for this element.

The normalized tree already carries the author's explicit `a11y`
values plus any tree-authored defaults (role from the widget-type
table, implicit `radio_group` wiring). This helper layers in the
widget-level fallbacks the render pipeline would apply:

- `text_input` / `text_editor` / `combo_box` / `pick_list`:
  `placeholder` flows into `description` when unset.
- `image` / `svg` / `qr_code`: `alt` flows into `label` when unset.

Returns an empty map (`%{}`) for elements the normalizer left
untouched, so tests can match on individual keys without having
to special-case `nil`.

# `text`

```elixir
@spec text(element :: t()) :: String.t() | nil
```

Extracts text content from an element.

Checks props in order: "content", "label", "value", "placeholder".
Returns nil if no text prop is found.

---

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