Skip to content

Preserve every HTML child in a Popup - #2342

Draft
adarshsm wants to merge 1 commit into
python-visualization:mainfrom
adarshsm:fix/1245-preserve-popup-children
Draft

adarshsm wants to merge 1 commit into
python-visualization:mainfrom
adarshsm:fix/1245-preserve-popup-children

Conversation

@adarshsm

Copy link
Copy Markdown
Contributor

Fixes #1245.

Popup currently calls setContent() for every HTML child. Each call replaces the previous content, so only the last child survives. This also removes the earlier chart containers when multiple Vega elements are added to a popup.

For multiple children, append their DOM nodes to one container and set the popup content once. Keep the existing single-child markup and child variables used by chart initialization. For lazy popups, load all children together in one click callback. Empty child output is ignored.

Added eager/lazy regression tests; both fail before the fix and pass afterward. An inverted multi-child condition also makes both tests fail.

Verification

  • pytest tests/test_map.py -q: 23 passed, including the new eager/lazy cases and the existing single-child rendering checks.
  • Local runtime check using real Leaflet 1.9.3 and jQuery 3.7.1 in jsdom: unmodified upstream retains only Second; the fix retains First and Second through loading and reopening in both modes, including an empty child. This checks popup DOM behavior, not Vega chart drawing or the Selenium suite.
  • Broader non-browser suite: 397 passed, 4 failed. The failures are the same missing-geodatasets and Selenium-dependent PNG failures verified on unmodified upstream earlier in this run.
  • Scoped ruff check and git diff --check: passed.

🤖 Generated with Claude Code

Combine multiple child nodes before setting popup content so later children do not overwrite earlier ones. Load lazy children together while keeping single-child markup unchanged.

Co-Authored-By: Claude Code <noreply@anthropic.com>

This branch was previously deployed

1 inactive deployment
pypi — 53ab5439 Deployed Nov 14, 2026 by adarshsm via packages #2066
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple Vincent/Vega charts in a popup?

1 participant