fix(frontend): restore network topology rendering in Safari - #1834
Conversation
WebKit paints positioned HTML and opacity layers inside SVG foreignObject at the SVG origin. Device cards, labels and icons overlap there while their connections remain at the expected coordinates. Keep node content in normal flow, place collapse controls with a float and height-derived negative margin, and use alpha colors for muted icons. Scope all style changes to the network tree. Related: netalertx#1116 Discussion: netalertx#1379
Add a standalone fixture using the real topology renderer and styles. Check painted pixels in WebKit, Chromium and Firefox because DOM bounds can remain correct when WebKit paints foreignObject content incorrectly. Exercise node clicks, collapse/expand, wheel zoom and drag pan, including assertions that pointer gestures change the SVG transform. Document dependency installation and execution separately from pytest. The regression fails with the original frontend and passes with the fix.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughNetwork-tree positioning and icon styling changed. The collapse control uses a height-based negative margin. A standalone regression test checks rendering and interactions in WebKit, Chromium, and Firefox. ChangesNetwork topology
Suggested reviewers: Priority: ➖ Normal Change: Bug fix Merge Risk: ⚪ Minimal · up to No confirmed issue currently blocks merging the topology fix after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The rendering fix has limited architectural impact. The new test server is restricted to loopback, but its file-serving check can follow repository symlinks outside the repository. Exposure is conditional and limited to the test host; no production endpoint or actual data disclosure was demonstrated. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks so much @itwormz 🙏 I thought I will never get this one fixed - I'm not into apple stuff 😄 |
📌 Description
Safari renders the network topology's SVG links, but paints device cards,
labels and icons at the SVG origin. The cards overlap in the upper-left
corner instead of appearing at the ends of their connections.
The nodes use HTML inside SVG
foreignObject. Positioned elements andopacity layers trigger WebKit's rendering issue. This change keeps their
layout in normal flow and uses alpha colors for muted icons:
color-mix.The hierarchy, links, device data and click handlers retain their existing contracts.
Commit structure
The implementation and regression coverage are deliberately separate:
071a4dd— Safari fix only: network-tree CSS and the collapse control's height-derived margin infront/js/network-tree.js.1aceeae— Regression tests and documentation only: the standalone browser test, HTML fixture and testing guide.The fix can be reviewed or cherry-picked independently. The test commit introduces
no production dependency; Playwright and pngjs are installed separately for test execution.
🔍 Related Issues
📋 Type of Change
📷 Screenshots or Logs
The regression fails on the original code with:
The same test passes after the fix in WebKit, Chromium and Firefox.
DOM bounds alone are insufficient: WebKit can report correct bounds while
painting the HTML at the wrong position, so the test checks screenshot pixels too.
🧪 Testing Steps
git diff --checkpass.pytest test/suite on Debian. The non-Docker tests passed: 1665 passed, 30 skipped.48fa0392:test_host_network_composeandtest_normal_startup_no_warnings_compose. The existing host-network check treats the Debian LXC host'seth0@if…interface as Docker bridge networking and emits an unexpected warning even withnetwork_mode: host.The standalone browser regression and its installation commands are documented
in
test/ui/TESTING_GUIDE.md. It runs separately from pytest and needs noNetAlertX backend or database.
✅ Checklist
🙋 Additional Notes
AI-assisted contribution: The implementation, regression tests and PR description were prepared with OpenAI Codex. Human-reviewed and approved for submission by @itwormz.
Native iPhone/iPad Safari has not been tested. This PR fixes the observed
network topology rendering issue; it does not declare general Safari support.
Summary by CodeRabbit