saadeghi/daisyui · error · Error

Tailwind Play's editor did not accept the paste event: ${JSO

Error message

Tailwind Play's editor did not accept the paste event: ${JSON.stringify(pasteResult)}

What it means

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.

Source

Thrown at packages/tailwind-play-share/index.mjs:761

          composed: true,
        });
        const dispatched = target.dispatchEvent(event);
        return {
          activeElement: target.tagName.toLowerCase(),
          className: typeof target.className === "string" ? target.className.slice(0, 120) : "",
          ok: !dispatched || event.defaultPrevented,
        };
      } catch (error) {
        return {
          activeElement: target.tagName.toLowerCase(),
          error: error?.message ?? String(error),
          ok: false,
        };
      }
    })()`,
  )
  if (!pasteResult?.ok) {
    throw new Error(
      `Tailwind Play's editor did not accept the paste event: ${JSON.stringify(pasteResult)}`,
    )
  }
}

async function setWithEditorUi(client, html, css, timeoutMs) {
  for (const [label, source] of [
    ["HTML", html],
    ["CSS", css],
  ]) {
    await clickEditorTab(client, label)
    const focusResult = await focusVisibleEditor(client, label, timeoutMs)
    if (!focusResult?.ok) {
      const diagnostics = focusResult?.diagnostics?.length
        ? ` Editor DOM: ${JSON.stringify(focusResult.diagnostics)}`
        : ""
      throw new Error(`Could not focus Tailwind Play's ${label} editor.${diagnostics}`)
    }

View on GitHub (pinned to 42b09e637e)

Solutions

  1. Increase --timeout so focusVisibleEditor has time to land on the real editor input before replaceActiveEditor runs.
  2. Update tailwind-play-share; the focus heuristics track Monaco/CodeMirror DOM changes.
  3. Run with --verbose and --headed and read the activeElement/className fields in the error to see what was actually focused.
  4. Retry createTailwindPlay; the focus timing is racy.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  url = await createTailwindPlay(inputs)
} catch (error) {
  if (error.message.startsWith("Tailwind Play's editor did not accept the paste event")) {
  // read the embedded pasteResult JSON to see what element was focused
  }
  throw error
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of saadeghi/daisyui@42b09e637e (2026-08-13). Data as JSON: /api/errors/907fabb49ba74e32. Report an issue: GitHub.