claude-artifact-framework 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-artifact-framework",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Utilities for building apps inside Claude Artifacts: platform storage, chat tool-calling loops, and other primitives verified against the real runtime.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.esm.js",
package/src/chat.js CHANGED
@@ -226,23 +226,33 @@ export function ChatLayout({ spec, ctx }) {
226
226
  busy && live === null ? h("div", { className: "caf-msg-tools" }, "thinking…") : null,
227
227
  h("div", { ref: endRef })
228
228
  ),
229
+ // Deliberately NOT a <form>: the artifact iframe's sandbox lacks
230
+ // allow-forms, so native form submission is blocked there — and on mobile
231
+ // the keyboard's send key triggers exactly that implicit submission. A
232
+ // plain div with onClick + Enter via onKeyDown never touches the native
233
+ // form machinery, so it can't be sandboxed away.
229
234
  h(
230
- "form",
231
- {
232
- className: "caf-chat-input",
233
- onSubmit: (e) => {
234
- e.preventDefault();
235
- send();
236
- },
237
- },
235
+ "div",
236
+ { className: "caf-chat-input" },
238
237
  h("input", {
239
238
  value: draft,
240
239
  placeholder: c.placeholder || "Message…",
241
240
  disabled: busy,
241
+ enterKeyHint: "send",
242
242
  onChange: (e) => setDraft(e.target.value),
243
+ onKeyDown: (e) => {
244
+ if (e.key === "Enter") {
245
+ e.preventDefault();
246
+ send();
247
+ }
248
+ },
243
249
  "aria-label": "Message",
244
250
  }),
245
- h("button", { type: "submit", className: "caf-btn caf-btn-primary", disabled: busy || !draft.trim() }, "Send")
251
+ h(
252
+ "button",
253
+ { type: "button", className: "caf-btn caf-btn-primary", disabled: busy || !draft.trim(), onClick: send },
254
+ "Send"
255
+ )
246
256
  )
247
257
  );
248
258
  }