Skip to content

Conversation

@SliverKeigo
Copy link

Description

This PR fixes an issue where the TextField component in the Lit renderer was ignoring the type property (e.g., "number") from the A2UI JSON payload.

Problem

A property name mismatch between the renderer and component caused the input type to be ignored:

Location Property Name Code
root.ts (Sender) .type .type=${node.properties.type}
text-field.ts (Receiver) inputType accessor inputType

Result: <input type="number"> rendered as <input type="text">, allowing non-numeric input in number fields.

Solution

  1. Lit Component (text-field.ts): Renamed inputTypetextFieldType to avoid conflicts with the component's class type identifier.

  2. Root Renderer (root.ts): Updated binding to .textFieldType=${node.properties.type}.

  3. Samples (a2ui_examples.py): Added explicit "type": "shortText" and "type": "number" usage for clarity.

Verification

  • textFieldType correctly receives values from JSON payload
  • ✅ HTML input renders with type="number" when specified

Hi @jacobsimionato 👋

Could you please take a look or help arrange a review?

Thanks! 🙏

Previously, the 'type' property from A2UI JSON was not being correctly applied to the HTML input element in the Lit renderer. This was due to a property name mismatch where the component expected 'inputType' (or 'type' which conflicted with the component's own type identifier) but the root renderer was not mapping it correctly.

This commit:
1. Renames the internal Lit component property to 'textFieldType' to explicitly distinguish it from the component's class type.
2. Updates the root renderer to map the JSON 'type' property to this new 'textFieldType' property.
3. Updates the restaurant finder agent example to explicitly use 'type': 'shortText' for dietary requirements, ensuring better type safety and example clarity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant