feat(options): header row of Top-of-page tab — font+color in col 1, background in col 2

Row 136: in the "Top of the page" tab the header section columns are swapped:
column 1 now holds the header font (headerfont) with the menu item color
(navbarfontcolor + custom picker) stacked below it; column 2 holds the header
background color (headerbackgroundcolor + custom). Slot mapping changed
accordingly (headerfont/navbarfontcolor(+custom) = h1 = row+col 1, header
background = h2 = col 2, sticky = h3 = col 3) and aTopOfPageKeys reordered.

The header background color in column 2 is lowered to align with the color
option in column 1: a new alignHeaderColumns step in options.js measures the
vertical offset between the navbarfontcolor block and the background column
(getBoundingClientRect, no hardcoded px) and applies it as padding-top on the
background column. OPTIONS_JS_TOKEN -> 20261126.15. Verified: render tc=633
(col1 = headerfont+navbarfontcolor, col2 = headerbackgroundcolor, divs 312/312,
options.js?v=20261126.15), jsdom 7/7 incl. new pins (header row order in raw
HTML; measured padding-top applied with a faked getBoundingClientRect), export
exit 0. Variants not rebuilt (deferred).

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-26 19:25:22 +01:00
commit f812268ffa

View file

@ -887,6 +887,25 @@ var ThemeOptions = function () {
if (customInput.length) { customInput.on('input change', refreshAll); }
};
// THEME ADDITION (row 136): in the "Top of the page" tab the header row is
// col 1 = font + menu item color, col 2 = header background color. Lower the
// background column so its option aligns with the color option in col 1:
// measure the vertical distance between the navbarfontcolor block's top and
// the background column's top and apply it as padding-top (robust against
// font-size/line-height differences — no hardcoded px).
var alignHeaderColumns = function () {
var row = globalForm.find('.top-section-header').first();
if (!row.length) { return; }
var bgField = globalForm.find('#simple_edit_options_headerbackgroundcolor');
var colorField = globalForm.find('#simple_edit_options_navbarfontcolor');
if (!bgField.length || !colorField.length) { return; }
var bgCol = bgField.closest('.top-section-header .col-md-4');
var colorWrap = colorField.closest('.mb-3');
if (!bgCol.length || !colorWrap.length || !bgCol[0].getBoundingClientRect) { return; }
var diff = colorWrap[0].getBoundingClientRect().top - bgCol[0].getBoundingClientRect().top;
if (diff > 0) { bgCol[0].style.paddingTop = diff + 'px'; }
};
// Shared delegated handlers for ALL chooser dropdowns (row 122/135): a REAL user
// change event bubbles natively to document even when an earlier direct handler
// threw (jQuery only aborts synthetic triggers), so the active outline still moves
@ -967,6 +986,10 @@ var ThemeOptions = function () {
});
safeStep('bindColorModeDelegates', bindColorModeDelegates);
// THEME ADDITION (row 136): align the header background color (col 2) with
// the menu item color option (col 1) in the Top-of-the-page tab
safeStep('alignHeaderColumns', alignHeaderColumns);
// THEME ADDITION (row 133): restore the options tab the user was on before
// Save (after a save the page reloads on the first tab)
safeStep('restoreActiveTab', restoreActiveTab);