Skip to content

fix: anchor extension badges inside signed-section, not the viewport#3

Merged
jt55401 merged 1 commit into
mainfrom
fix/signed-section-badge-anchoring
May 13, 2026
Merged

fix: anchor extension badges inside signed-section, not the viewport#3
jt55401 merged 1 commit into
mainfrom
fix/signed-section-badge-anchoring

Conversation

@jt55401
Copy link
Copy Markdown
Contributor

@jt55401 jt55401 commented May 13, 2026

The symptom

Extension verification badges appeared off-screen, above the viewport's top edge, once the user scrolled into a content page.

Root cause

The site is already wrapping just the article body — <signed-section> opens after the page <h1> and closes before </article>. That part is fine.

But the htmltrust-hugo module's partial emits the element with only style=\"display: block;\" inline. The extension positions its badge with position: absolute; top: -10px; right: 10px;, so the badge anchors to the nearest positioned ancestor — and since none of <signed-section>, <article>, or the page wrappers have position set, the badge bubbles up to the viewport. That puts it 10px below the document top, which is above the visible viewport whenever the user has scrolled.

Fix

Local override of layouts/_partials/htmltrust-signed-section.html that adds position: relative; to the inline style:

style=\"display: block; position: relative;\"

Now the badge anchors to the top-right of the actual signed article body, where it's visible.

Verify

curl -sL https://www.htmltrust.org/spec/ | grep -o '<signed-section[^>]*>'
# should show the position: relative in the style attribute

After this lands and Cloudflare redeploys, install the browser extension and scroll the spec page — badge should appear at the top-right of the article body.

🤖 Generated with Claude Code

The site wraps only the article body in <signed-section> (it opens
after the page <h1> and closes before </article>), so the wrap is
already correct. But the browser extension positions its verification
badge with `position: absolute; top: -10px; right: 10px;` relative to
the nearest positioned ancestor. The <signed-section> only had
`style="display: block;"` inline, so the badge bubbled up the
ancestor tree to the viewport — appearing 10px below the top of the
*document*, off-screen once the user scrolled into the article.

Overrides the htmltrust-hugo module's partial to add
`position: relative;` to the inline style on the emitted
<signed-section>. With that, the absolutely-positioned badge anchors
to the top-right of the signed article body, where it's actually
visible.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jt55401 jt55401 merged commit 85337bc into main May 13, 2026
2 checks passed
@jt55401 jt55401 deleted the fix/signed-section-badge-anchoring branch May 13, 2026 23:52
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.

1 participant