From b52568437866bbeb3dedb73c0d775f66876af3a5 Mon Sep 17 00:00:00 2001 From: Liang Jiaqing Date: Tue, 7 Apr 2026 10:17:55 +0800 Subject: [PATCH] fix: hoist filter should not catch sticky elements or oversized containers - Remove position:sticky from hoist criteria (sticky is scroll-following, not popup) - Add cover < 1.0 upper bound (real dialogs do not exceed viewport area) --- simphtml.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simphtml.py b/simphtml.py index 3f5af71..839a95d 100644 --- a/simphtml.py +++ b/simphtml.py @@ -291,10 +291,10 @@ function analyzeNode(node, pPathType='main') { const _fc = [...domCopy.querySelectorAll('*')].filter(el => { if (el.parentNode === domCopy) return false; const info = getNodeInfo(el); - if (!info?.rect || (info.style.position !== 'fixed' && info.style.position !== 'sticky')) return false; + if (!info?.rect || info.style.position !== 'fixed') return false; const r = info.rect, cover = (r.width * r.height) / viewportArea; const cd = Math.abs((r.left + r.width/2) - window.innerWidth/2) / window.innerWidth; - return cover > 0.15 && cd < 0.3 && el.querySelector('button, input, a, [role="button"], iframe'); + return cover > 0.15 && cover < 1.0 && cd < 0.3 && el.querySelector('button, input, a, [role="button"], iframe'); }).filter((el, _, arr) => !arr.some(o => o !== el && o.contains(el))) .sort((a, b) => (getNodeInfo(b).rect.width * getNodeInfo(b).rect.height) - (getNodeInfo(a).rect.width * getNodeInfo(a).rect.height)) .slice(0, 2);