惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
云风的 BLOG
云风的 BLOG
小众软件
小众软件
IT之家
IT之家
T
Tailwind CSS Blog
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
美团技术团队
博客园 - 叶小钗
V
V2EX
博客园 - Franky
大猫的无限游戏
大猫的无限游戏
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
阮一峰的网络日志
阮一峰的网络日志
博客园 - 【当耐特】
罗磊的独立博客
博客园_首页
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
爱范儿
爱范儿
宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Jina AI
Jina AI
月光博客
月光博客
有赞技术团队
有赞技术团队

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Why shadow DOM beat iframe for inline tooltips
J Now · 2026-05-23 · via DEV Community

J Now

The iframe approach seems obvious: sandboxed, isolated, clean. I tried it first. The problem is that iframes can't inherit host-page fonts without a FOUC — you either flash unstyled content, or you hardcode a font stack and accept that your tooltip looks alien on every site with a custom typeface. On a site like Wikipedia or the NYT, that mismatch is immediately jarring.

Shadow DOM solves this differently. The extension's tooltip attaches as a shadow host, which means it's structurally isolated from the page's CSS cascade but physically in the same document. The host page's font rendering applies at the OS level, so body text in the tooltip inherits the same antialiasing and subpixel rendering as the surrounding article. No flash. No mismatch.

The tradeoff is that shadow DOM isolation isn't total. Some CSS custom properties (variables) can pierce the shadow boundary, so if the host page defines something like --background: transparent at the :root level, you need to explicitly reset inside your shadow styles. I ran into this on a few dark-mode sites where the tooltip was inheriting a near-invisible background until I added an explicit background: white block scoped to the shadow root.

The other thing iframes make hard: positioning. An absolutely-positioned iframe has to fight the host page's stacking context and overflow rules. I wanted the tooltip to anchor to cursor position, which means reading mouseup coordinates and placing a DOM node there. With shadow DOM the placement logic is just standard position: fixed math. With an iframe, you're fighting overflow: hidden on parent containers on sites you don't control.

For rabbitholes — a Chrome extension that renders inline explanations from Claude Haiku 4.5 for any text you highlight — the shadow DOM approach means the tooltip looks at home on every site, inherits correct fonts without polling, and doesn't trigger layout shifts when it appears.

Zero telemetry, Manifest V3. Requests go directly from your browser to api.anthropic.com.

https://github.com/robertnowell/rabbitholes