{"record":{"id":"907fabb49ba74e32","repo":"saadeghi/daisyui","slug":"tailwind-play-s-editor-did-not-accept-the-paste-ev","errorCode":null,"errorMessage":"Tailwind Play's editor did not accept the paste event: ${JSON.stringify(pasteResult)}","messagePattern":"Tailwind Play's editor did not accept the paste event: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tailwind-play-share/index.mjs","lineNumber":761,"sourceCode":"          composed: true,\n        });\n        const dispatched = target.dispatchEvent(event);\n        return {\n          activeElement: target.tagName.toLowerCase(),\n          className: typeof target.className === \"string\" ? target.className.slice(0, 120) : \"\",\n          ok: !dispatched || event.defaultPrevented,\n        };\n      } catch (error) {\n        return {\n          activeElement: target.tagName.toLowerCase(),\n          error: error?.message ?? String(error),\n          ok: false,\n        };\n      }\n    })()`,\n  )\n  if (!pasteResult?.ok) {\n    throw new Error(\n      `Tailwind Play's editor did not accept the paste event: ${JSON.stringify(pasteResult)}`,\n    )\n  }\n}\n\nasync function setWithEditorUi(client, html, css, timeoutMs) {\n  for (const [label, source] of [\n    [\"HTML\", html],\n    [\"CSS\", css],\n  ]) {\n    await clickEditorTab(client, label)\n    const focusResult = await focusVisibleEditor(client, label, timeoutMs)\n    if (!focusResult?.ok) {\n      const diagnostics = focusResult?.diagnostics?.length\n        ? ` Editor DOM: ${JSON.stringify(focusResult.diagnostics)}`\n        : \"\"\n      throw new Error(`Could not focus Tailwind Play's ${label} editor.${diagnostics}`)\n    }","sourceCodeStart":743,"sourceCodeEnd":779,"githubUrl":"https://github.com/saadeghi/daisyui/blob/42b09e637e09467aa54a813a5aea53c1179aec75/packages/tailwind-play-share/index.mjs#L743-L779","documentation":"Thrown by replaceActiveEditor after dispatching a synthetic paste ClipboardEvent onto document.activeElement and the result object reported ok === false. The full pasteResult JSON (activeElement tag, className, error message) is embedded for diagnosis. This is the keyboard fallback's mechanism for injecting HTML/CSS into the editor.","triggerScenarios":"The paste handler returned ok:false either because dispatchEvent returned true without defaultPrevented (nothing handled the paste), the active element was body/documentElement, or constructing/dispatching the ClipboardEvent threw.","commonSituations":"The focused element is not the actual editor input (Monaco textarea, CodeMirror cm-content), Tailwind Play's editor does not listen for paste on the focused node, the focus step landed on a wrapper div, or a CSP/security policy blocked DataTransfer/ClipboardEvent construction.","solutions":["Increase --timeout so focusVisibleEditor has time to land on the real editor input before replaceActiveEditor runs.","Update tailwind-play-share; the focus heuristics track Monaco/CodeMirror DOM changes.","Run with --verbose and --headed and read the activeElement/className fields in the error to see what was actually focused.","Retry createTailwindPlay; the focus timing is racy."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  url = await createTailwindPlay(inputs)\n} catch (error) {\n  if (error.message.startsWith(\"Tailwind Play's editor did not accept the paste event\")) {\n  // read the embedded pasteResult JSON to see what element was focused\n  }\n  throw error\n}","preventionTips":["Raise --timeout so the focus step lands on the real editor input first.","Keep the script updated; paste/focus heuristics track editor DOM changes.","Inspect the activeElement/className fields in the error to diagnose focus."],"tags":["dom","editor-ui","clipboard","browser-automation"],"backgroundTag":null,"analyzedSha":"42b09e637e09467aa54a813a5aea53c1179aec75","analyzedAt":"2026-08-13T04:10:09.555Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}