Schirme die Messkopie der Navigation vollständig ab.
CI Feature / test (push) Successful in 35s
Deploy Test / test (push) Successful in 32s
Deploy Test / deploy (push) Successful in 29s

Die unsichtbare Kopie für die Breitenmessung trug Kennungen, Ziele und
Skript-Merkmale der echten Navigation sowie die Klasse site-header.
Sie ist jetzt inert, ohne id, href, aria- und data-Attribute und ohne
Kopfzeilenklasse; der Abstand zur Wortmarke wird an der echten
Navigation gemessen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-11-18 06:55:25 +01:00
1 parent 33aaf64024
commit 8390dcdb41
1 file changed
+15 -4
+15 -4
View File
@@ -103,7 +103,7 @@ function setupMode(header, closeMenu) {
// Unsichtbare Kopie von Navigation und Kontozugang in Desktop-Darstellung: liefert die benötigten Breiten in jedem Modus.
const probe = document.createElement('div');
probe.className = 'site-header site-nav-probe';
probe.className = 'site-nav-probe';
probe.setAttribute('aria-hidden', 'true');
probe.style.cssText = 'position:absolute;visibility:hidden;pointer-events:none;left:-10000px;top:0;height:auto;padding:0;width:max-content;';
const nav = document.createElement('nav');
@@ -111,16 +111,27 @@ function setupMode(header, closeMenu) {
nav.appendChild(list.cloneNode(true));
const accountProbe = account.cloneNode(true);
probe.append(nav, accountProbe);
probe.querySelectorAll('[id]').forEach((node) => node.removeAttribute('id'));
probe.querySelectorAll('a, button').forEach((node) => node.setAttribute('tabindex', '-1'));
// Die Kopie ist reine Messfläche: nicht bedienbar, nicht vorgelesen, ohne Kennungen, Ziele und Skript-Merkmale.
probe.inert = true;
probe.querySelectorAll('*').forEach((node) => {
[...node.attributes]
.filter((attribute) => attribute.name === 'id' || attribute.name === 'href' || attribute.name.startsWith('aria-') || attribute.name.startsWith('data-'))
.forEach((attribute) => node.removeAttribute(attribute.name));
});
document.body.appendChild(probe);
const width = (element) => element.getBoundingClientRect().width;
const realNav = header.querySelector('.site-nav');
let lastNavMargin = 32;
const update = () => {
const gap = parseFloat(getComputedStyle(inner).columnGap) || 0;
const actionsGap = parseFloat(getComputedStyle(actions).columnGap) || 0;
const navMargin = parseFloat(getComputedStyle(nav).marginLeft) || 0;
// Abstand zwischen Wortmarke und Navigation in Desktop-Darstellung; im Menümodus der zuletzt gemessene Wert.
if (!isMenuMode(header)) {
lastNavMargin = parseFloat(getComputedStyle(realNav).marginLeft) || 0;
}
const navMargin = BASELINE.matches ? 0 : lastNavMargin;
let fixedActions = width(actions) - width(account);
if (menuButton && menuButton.offsetParent !== null) {
fixedActions -= width(menuButton) + actionsGap;