From f3dc3e7cd38e84f5d9387cd43c8b128ebfcb736a Mon Sep 17 00:00:00 2001 From: TripleU <182648541+TripleU613@users.noreply.github.com> Date: Sat, 21 Nov 2026 23:51:30 -0500 Subject: [PATCH] Ads: the fallback is the card's size, with no empty room above it The icons' holder in the fallback's root was hidden with the hidden attribute, which does nothing on an svg, so it held 300x150 of empty room above the card. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BUGDaR7qv2d8CuVp7UGSTs --- .../connectors/above-main-container/jt-lines-fallback.gts | 3 ++- spec/system/ads_spec.rb | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/assets/javascripts/discourse/connectors/above-main-container/jt-lines-fallback.gts b/assets/javascripts/discourse/connectors/above-main-container/jt-lines-fallback.gts index 15296905..cf29ddf8 100644 --- a/assets/javascripts/discourse/connectors/above-main-container/jt-lines-fallback.gts +++ b/assets/javascripts/discourse/connectors/above-main-container/jt-lines-fallback.gts @@ -55,7 +55,8 @@ export default class JtLinesFallback extends Component { this.host.className = this.hostClass; this.#root = this.host.attachShadow({ mode: "closed" }); this.#root.adoptedStyleSheets = [sheet()]; - this.#sprite.setAttribute("hidden", ""); + // hidden takes no effect on an svg: it would hold 300×150 of room + this.#sprite.style.display = "none"; this.inner.className = "jt-lines"; this.#root.append(this.#sprite, this.inner); } diff --git a/spec/system/ads_spec.rb b/spec/system/ads_spec.rb index 812b9393..2d09c4f8 100644 --- a/spec/system/ads_spec.rb +++ b/spec/system/ads_spec.rb @@ -149,6 +149,13 @@ def hide_space "Spring sale", ) end + + # the fallback is the card's size, nothing more + sizes = + page.evaluate_script( + "[#{host}, #{fallback}.querySelector('.jt-lines')].map((el) => el.getBoundingClientRect().height)", + ) + expect(sizes[0]).to be_within(1).of(sizes[1]) end # Nothing outside the root a page rule could name, and a script that