Skip to content

Placeholder node content lost on blur without Enter key #681

Closed

Description

@malibio

Overview

When typing content into a placeholder node and clicking away (blur) without pressing Enter, the content disappears and the node is not saved.

Steps to Reproduce

  1. Navigate to a date node or any container node that shows an empty placeholder
  2. Click into the placeholder to start editing
  3. Type some content (e.g., "test content" or inline markdown like **bold**)
  4. Click away from the node (blur) WITHOUT pressing Enter
  5. Expected: Content should be saved and node should persist
  6. Actual: Content disappears, placeholder resets to empty state

Analysis

The placeholder promotion logic in base-node-viewer.svelte only triggers in the contentChanged handler when:

  • currentPlaceholder exists
  • node.id === currentPlaceholder.id
  • content.trim() !== ''
  • nodeId exists (parent node ID)

However, the blur event handler in base-node.svelte (lines 641-661) does NOT trigger any persistence or promotion logic - it only:

  1. Clears the editing state via focusManager.clearEditing()
  2. Hides autocomplete modal

This means if the user types content but blurs before any condition triggers promotion, the placeholder content is lost.

Root Cause

The contentChanged event fires on every input, so theoretically promotion should happen. However, there may be a race condition or timing issue where:

  1. Content is typed
  2. contentChanged fires and promotion starts
  3. User blurs before promotion completes
  4. Blur clears editing state
  5. Placeholder is garbage collected with unsaved content

Or alternatively, the promotion condition is not being met for some reason (need to investigate which condition is failing).

Relevant Code Locations

  • Blur handler: packages/desktop-app/src/lib/design/components/base-node.svelte lines 641-661
  • Placeholder promotion: packages/desktop-app/src/lib/design/components/base-node-viewer.svelte lines 1269-1333
  • viewerPlaceholder derived: packages/desktop-app/src/lib/design/components/base-node-viewer.svelte lines 116-132
  • shouldShowPlaceholder: packages/desktop-app/src/lib/design/components/base-node-viewer.svelte lines 1150-1155

Potential Fixes

  1. Fire contentChanged on blur: Ensure the final content state is sent before blur clears editing
  2. Add blur handler for placeholder promotion: Check if placeholder has content on blur and promote it
  3. Investigate race condition: Add logging to understand why promotion isn't completing

Acceptance Criteria

  • Placeholder content persists when user clicks away (blur)
  • Placeholder content persists when user presses Enter (existing behavior)
  • No regression in normal node editing
  • Tests added for blur-based placeholder persistence

Activity

  1. added
    bug
    on Nov 28, 2025
  2. self-assigned this
    on Nov 28, 2025
  3. added 3 commits that reference this issue on Nov 28, 2025
    b4a263a
    bc89294
    62977f0
  4. added a commit that references this issue on Nov 29, 2025
    2c9f426
  5. added 2 commits that reference this issue on Feb 4, 2026
    87be727
    a1fcd53
  6. added a commit that references this issue on Feb 26, 2026
    2af6d10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugfrontend

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions