From 8328bf09645013aacdde7d046319324ce094b522 Mon Sep 17 00:00:00 2001 From: Umut Kantarci Date: Wed, 16 Sep 2026 22:06:58 +0200 Subject: [PATCH] Give the scroll-to-top target a block box, and take the toolbar lift back out Umut, after 1.21.3: "fix hat nichts gebracht" - and the fix could not have, for two reasons. kant-it.de still runs 1.20.1, so nothing since then was ever live there. And the diagnosis behind 1.21.3 rested on a test that proved nothing: Safari's folded address bar shows only the domain, never the fragment, so "nothing in the address bar" said nothing about whether the tap had arrived. Reproduced this time in the real engine: Playwright's WebKit with the iPhone 14 profile. The tap arrives, #seitenanfang lands in the URL, and scrollY stays at 1500. Setting location.hash directly does the same. In the desktop profile as well, so this is Safari on the Mac too. Chromium jumps to 0. Narrowed down with fourteen variants of the target: WebKit does not scroll to a fragment target whose box is inline and has no area. The same empty span with display:block jumps; an empty div with no height jumps; #top, #main and body jump. It is the inline box, not the size. The section anchors are not affected - position:absolute already blockifies them and they jump in WebKit. So the target gets display:block, one rule in site.css. The template stays as it is. And the lift from 1.21.3 comes out again: --kant-browser-chrome and the six places that added it to bottom or padding. It moved the button and the consent bar up by the folded toolbar's height on every iPhone, for a cause that turned out not to be the cause. On the desktop it was zero anyway. WebKit iPhone 14 after the change: tap 0, click 0, hash 0. Chromium unchanged. Co-Authored-By: Claude Fable 5.1 --- public/assets/site.css | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/public/assets/site.css b/public/assets/site.css index 447aa58..649c3a2 100644 --- a/public/assets/site.css +++ b/public/assets/site.css @@ -6,21 +6,6 @@ h1,h2,h3,h4,h5,h6{hyphens:manual} p{hyphens:auto} .visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.block-image{margin:0;max-width:100%}.block-image img{max-width:100%;height:auto} :root{color-scheme:var(--k-scheme,light);--paper:#f7f8f4;--ink:#182d2b;--muted:#50625d;--line:#d7dfd7;--mint:#e5f0b6;--accent:#315b49;--error:var(--k-error,#8b2f22);--error-bg:var(--k-error-bg,#fff0eb);--error-line:var(--k-error-line,#e2b2a7);font-family:Arial,Helvetica,sans-serif;color:var(--ink);background:var(--paper);font-synthesis:none} -/* Die Hoehe der Browserleiste, die ueber dem Inhalt liegt. - Safari auf dem iPhone schiebt seine Adressleiste beim Herunterscrollen zu einem schmalen - Balken zusammen und legt den ueber die Seite. Ein fixiertes Element rechnet sein `bottom` - aber gegen die volle Ansicht, nicht gegen den freien Teil - was unten klebt, steht damit in - dem Streifen, den der Browser sich selbst genommen hat. Sichtbar ist es, aber jeder Tipp - landet auf der Leiste. Genau das war mit dem Nach-oben-Knopf: am Schreibtisch tadellos, auf - dem Telefon tot, auf jeder Seite jeder Installation. - Die Differenz zwischen grosser Ansicht (`lvh`, Leiste zusammengeschoben) und kleiner Ansicht - (`svh`, Leiste ausgefahren) ist genau diese Hoehe. Wo es keine solche Leiste gibt, ist sie - null, und nichts verschiebt sich. - Die Abfrage davor ist Pflicht, nicht Vorsicht: kennt ein Browser die Einheiten nicht, waere - die Rechnung erst beim Errechnen ungueltig, und `bottom` fiele auf `auto` zurueck - das Ding - stuende dann irgendwo. So bleibt es schlicht bei null. */ -:root{--kant-browser-chrome:0px} -@supports (height:100lvh) and (height:100svh){:root{--kant-browser-chrome:calc(100lvh - 100svh)}} *{box-sizing:border-box}body{margin:0}a{color:inherit;text-underline-offset:5px}a:hover{text-decoration-thickness:2px}:focus-visible{outline:3px solid var(--accent);outline-offset:6px}main:focus{outline:none}.shell{width:min(var(--k-container,1180px),calc(100% - 64px));margin-inline:auto}.site-header{border-bottom:1px solid var(--line)}.site-header.is-sticky{position:sticky;top:0;z-index:40;background:var(--paper);box-shadow:0 1px 0 var(--line),0 10px 30px color-mix(in srgb,var(--ink) 8%,transparent)} /* Über dem Inhalt: der Kopf nimmt keinen Platz ein, die erste Sektion beginnt unter ihm. Farbe und Schatten kommen aus der Gestaltung des Kopfbereichs, auch die für den gescrollten Zustand. */ @@ -197,9 +182,7 @@ p{hyphens:auto} Aussehen aus den Einstellungen: `--kant-consent-*` im Kopf der Seite (Consent::styles), die Anordnung als Klasse. Ohne Einstellung gilt Papier, Tinte und Akzent des Themes. Ein Wert wie `--k-consent` aus der Palette bleibt als Zwischenstufe erhalten. */ -/* Das `+ var(--kant-browser-chrome)` hebt die Leiste ueber Safaris zusammengeschobene - Adressleiste; sonst liegen „Annehmen“ und „Ablehnen“ unter ihr und sind nicht zu treffen. */ -.consent-bar{position:fixed;inset-inline:16px;bottom:calc(16px + var(--kant-browser-chrome));z-index:50;max-width:640px;max-height:calc(100dvh - 24px);overflow:auto;margin-inline:auto;background:var(--kant-consent-bg,var(--paper));color:var(--kant-consent-ink,var(--ink));border:1px solid color-mix(in srgb,currentColor 12%,transparent);border-radius:var(--kant-consent-radius,18px);padding:22px 24px 20px;box-shadow:0 24px 60px color-mix(in srgb,var(--ink) 22%,transparent);font-size:14px;line-height:1.6;overscroll-behavior:contain} +.consent-bar{position:fixed;inset-inline:16px;bottom:16px;z-index:50;max-width:640px;max-height:calc(100dvh - 24px);overflow:auto;margin-inline:auto;background:var(--kant-consent-bg,var(--paper));color:var(--kant-consent-ink,var(--ink));border:1px solid color-mix(in srgb,currentColor 12%,transparent);border-radius:var(--kant-consent-radius,18px);padding:22px 24px 20px;box-shadow:0 24px 60px color-mix(in srgb,var(--ink) 22%,transparent);font-size:14px;line-height:1.6;overscroll-behavior:contain} /* Ein schmaler Streifen in der Akzentfarbe oben: die Fläche gehört sichtbar zur Website. */ .consent-bar::before{content:'';position:absolute;inset:0 0 auto 0;height:4px;background:var(--kant-consent-accent,var(--k-consent,var(--accent)))} .kant .consent-bar h2{display:flex;align-items:center;gap:10px;font-size:17px;line-height:1.3;margin:0 0 8px} @@ -231,10 +214,7 @@ p{hyphens:auto} .consent-links a:hover{color:var(--kant-consent-accent,var(--k-consent,var(--accent)))} /* Leiste: über die ganze Breite am unteren Rand, auf breiten Bildschirmen Text links und Knöpfe rechts. Ecke: eine kleine Karte rechts unten, die den Inhalt kaum verdeckt. */ -/* Klebt die Leiste an der Kante, wird sie nicht angehoben - das gaebe einen Spalt, durch den - die Seite scheint. Stattdessen waechst ihr unterer Innenabstand um die Hoehe der - Browserleiste, sodass die Knoepfe darueber bleiben. */ -.consent-layout-leiste{inset-inline:0;bottom:0;max-width:none;border-radius:var(--kant-consent-radius,18px) var(--kant-consent-radius,18px) 0 0;border-inline:0;border-bottom:0;padding-inline:max(24px,calc((100% - 1180px) / 2));padding-bottom:calc(20px + var(--kant-browser-chrome))} +.consent-layout-leiste{inset-inline:0;bottom:0;max-width:none;border-radius:var(--kant-consent-radius,18px) var(--kant-consent-radius,18px) 0 0;border-inline:0;border-bottom:0;padding-inline:max(24px,calc((100% - 1180px) / 2))} @media (min-width:900px){.consent-layout-leiste{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 40px;align-items:center}.consent-layout-leiste .consent-body p{margin-bottom:0}.consent-layout-leiste .consent-form{width:360px;max-width:100%}} .consent-layout-ecke{inset-inline:auto 16px;max-width:400px;margin:0} /* While the question is open the bar is fixed at the bottom, so the page has to end above it - @@ -246,7 +226,7 @@ body.consent-open{padding-bottom:320px} @media (min-width:900px){body.consent-open{padding-bottom:200px}} .consent-page main{max-width:680px;margin-inline:auto;padding:40px 20px} .consent-page .consent-bar{position:static;inset:auto;box-shadow:none;max-width:none;max-height:none;margin:24px 0 0;display:block} -@media (max-width:620px){.consent-bar,.consent-layout-ecke{inset-inline:0;bottom:0;max-width:none;border-radius:var(--kant-consent-radius,18px) var(--kant-consent-radius,18px) 0 0;border-inline:0;border-bottom:0;padding:18px 18px calc(16px + var(--kant-browser-chrome))}.consent-layout-leiste{padding-inline:18px}} +@media (max-width:620px){.consent-bar,.consent-layout-ecke{inset-inline:0;bottom:0;max-width:none;border-radius:var(--kant-consent-radius,18px) var(--kant-consent-radius,18px) 0 0;border-inline:0;border-bottom:0;padding:18px 18px 16px}.consent-layout-leiste{padding-inline:18px}} /* An embedded third party, and what stands in its place until it may load. */ .block-embed iframe{display:block;width:100%;border:0;border-radius:10px;background:color-mix(in srgb,var(--ink) 8%,var(--paper))} @@ -512,18 +492,23 @@ body.consent-open{padding-bottom:320px} @media (min-width:1025px){.visibility-tablet,.visibility-mobile,.visibility-hide-desktop{display:none!important}} @media (min-width:768px) and (max-width:1024px){.visibility-desktop,.visibility-mobile,.visibility-hide-tablet{display:none!important}} @media (max-width:767px){.visibility-desktop,.visibility-tablet,.visibility-hide-mobile{display:none!important}} +/* Das Sprungziel des Knopfs „nach oben“, ein leerer am Anfang von . + WebKit springt nicht zu einem Ziel, dessen Box inline ist und keine Flaeche hat - der Tipp + kam an, #seitenanfang stand in der Adresse, und die Seite blieb stehen. Auf dem iPhone, + und ebenso in Safari auf dem Mac; Chromium ist toleranter, deshalb fiel es am Schreibtisch + nie auf. Ein leerer Block ohne Hoehe reicht WebKit, es ist die Inline-Box, die stoert. + Nachgestellt in Playwright-WebKit mit iPhone-Profil: inline bleibt bei 1500, block springt. */ +#seitenanfang{display:block} /* Der Knopf „nach oben". Ein Anker, kein Skript: er springt an den Anfang der Seite, und das kann ein Browser seit jeher allein. Eingeblendet wird er beim Scrollen über eine Scroll- Zeitachse - dieselbe Technik wie bei den Einblendungen. Wo es die nicht gibt (heute noch Safari), steht er von Anfang an da: sichtbar und nutzbar ist besser als unsichtbar. Aussehen, Größe, Form, Seite und Schwelle kommen aus den Einstellungen. */ .scroll-top{position:fixed;bottom:22px;right:22px;z-index:40;display:grid;place-items:center;width:var(--kant-top-size,48px);height:var(--kant-top-size,48px);border-radius:var(--kant-top-radius,999px);background:var(--kant-top-bg,var(--accent));color:var(--kant-top-ink,#fff);text-decoration:none;box-shadow:0 8px 24px color-mix(in srgb,var(--ink) 28%,transparent);font-size:calc(var(--kant-top-size,48px) / 2.4);line-height:1} -/* Ueber die Browserleiste hinaus, sonst ist der Knopf auf dem Telefon nicht zu treffen. */ -.scroll-top{bottom:calc(22px + var(--kant-browser-chrome))} .scroll-top-links{right:auto;left:22px} .scroll-top:hover{filter:brightness(1.08)} .scroll-top:focus-visible{outline:3px solid var(--accent);outline-offset:3px} -@media (max-width:767px){.scroll-top{bottom:calc(16px + var(--kant-browser-chrome));right:16px}.scroll-top-links{left:16px;right:auto}} +@media (max-width:767px){.scroll-top{bottom:16px;right:16px}.scroll-top-links{left:16px;right:auto}} /* Solange die Einwilligungsfrage offen ist, bleibt der Knopf da. Frueher verschwand er ganz - und auf dem Telefon bleibt die Frage oft einfach stehen, der Knopf kam dort also nie. Bis 799 px deckt die Leiste die Ecke ab, in der er steht: dort setzt er sich per