{
  "sample_id": "search-opens-empty",
  "title": "页面加载后才启动脚本，搜索弹窗整块空白",
  "source_kind": "issue_backed_merged_github_pr",
  "source": {
    "number": 4337,
    "merge": "c5d0a7fb0b9788d52d8f5345c6661f18e100359e",
    "base": "163d8aa867623d6e80d5560c71d9290a05926f92",
    "title": "Initialize search when its script runs after DOMContentLoaded",
    "merged_at": "2026-11-06T17:56:37Z",
    "issue": 4336,
    "repository": "withastro/starlight",
    "pull_request": "https://github.com/withastro/starlight/pull/4337",
    "issue_url": "https://github.com/withastro/starlight/issues/4336",
    "windows_materialized_internal_links": [
      "README.md"
    ],
    "changed_files": [
      {
        "path": ".changeset/docsearch-after-page-load.md",
        "status": "added"
      },
      {
        "path": ".changeset/search-after-page-load.md",
        "status": "added"
      },
      {
        "path": "packages/docsearch/src/DocSearch.astro",
        "status": "modified"
      },
      {
        "path": "packages/starlight/src/components/Search.astro",
        "status": "modified"
      }
    ]
  },
  "transcript": "有时候页面先加载完，搜索脚本晚一点才进来。我点这里的搜索。你看，弹窗里面是空的，连打字的框都没有。让这种情况也能输入和查到文档，正常打开的搜索照旧。",
  "recording": "recording.mp4",
  "audio_is_synthetic": true,
  "interaction_is_reenacted": true,
  "browser": "158.0.8127.37",
  "tts": {
    "model": "qwen-audio-3.1-tts-flash",
    "voice": "longanhuan_v3.1",
    "sample_rate_hz": 24000
  },
  "duration_sec": 16.54,
  "grounding": [
    {
      "cue": "这里的搜索",
      "has_dom_target": true,
      "target": "Search button",
      "keyframe": "keyframe-01.jpg",
      "cue_start_ms": 5210,
      "cue_end_ms": 6010,
      "frame_ms": 5610,
      "pointer": [
        468,
        30
      ],
      "region": {
        "x": 357.5625,
        "y": 11.5,
        "width": 352,
        "height": 40
      },
      "viewport": {
        "width": 1180,
        "height": 770
      },
      "page": "/?late=1"
    },
    {
      "cue": "弹窗里面",
      "has_dom_target": true,
      "target": "Open search dialog",
      "keyframe": "keyframe-02.jpg",
      "cue_start_ms": 6970,
      "cue_end_ms": 7690,
      "frame_ms": 7330,
      "pointer": [
        380,
        129
      ],
      "region": {
        "x": 270,
        "y": 64,
        "width": 640,
        "height": 240
      },
      "viewport": {
        "width": 1180,
        "height": 770
      },
      "page": "/?late=1"
    }
  ],
  "track_b_gt": [
    {
      "step": 1,
      "target": "页面完成加载后才执行脚本的 Starlight Pagefind 搜索弹窗",
      "instruction": "延迟加载时输入框也出现，能查询并显示实际站内结果，常规加载也能搜索。"
    }
  ],
  "visible_before_after_checks": [
    "late_dialog_has_input",
    "late_query_finds_doc",
    "ordinary_query_works"
  ],
  "reproduction_fixture": "reproduction-site/ (authored content and issue setup, original theme code)"
}
