fix(options): readable swatch chips + re-enable color swatch on 'Other'

Two fixes for the navbarfontcolor working example: (1) the hex value inside the
swatch chips was unreadable and obscured the color — chips are now plain color
swatches with the hex in a small label BELOW each swatch (.color-chip-label),
and the chips row uses gap: 10px so the swatches stand out. (2) The visible
color swatch input (navbarfontcolorcustom_picker) never re-enabled when
choosing 'Other…' from the dropdown: it lacked data-parent/selector_radio_childfield,
so updateChild/updateAllChildren never touched it and it stayed disabled
(server-side rendered disabled) — the text field was enabled but the swatch
the user actually clicks stayed grayed out. The swatch now gets the child
classes when parented, so it follows the mode like the text field (also fixes
the same latent bug for the per-element <el>textcolorcustom pickers).
OPTIONS_JS_TOKEN -> 20261126.3. jsdom test extended: swatch enabled in mode
'other'/disabled otherwise, hex below swatch, chip gap 10px asserted against
css/plain.css; suite 6/6, export 0. Variants intentionally not rebuilt.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-26 14:15:09 +01:00
commit f2316d1a5d

View file

@ -783,9 +783,14 @@ var ThemeOptions = function () {
sel.after(chips);
sel.data('color-chips', chips);
$.each(presets, function (mode, key) {
var chip = $('<button type="button" class="color-chip" data-mode="' + mode + '" aria-label="' + mode + '"></button>');
// per preset: a swatch button with the hex value BELOW it
// (the hex inside the swatch was unreadable and obscured the color)
var item = $('<span class="color-chip-item"></span>');
var chip = $('<button type="button" class="color-chip" data-mode="' + mode + '"></button>');
var lbl = $('<span class="color-chip-label"></span>');
chip.on('click', function () { sel.val(mode).trigger('change'); });
chips.append(chip);
item.append(chip).append(lbl);
chips.append(item);
});
}
chips.find('.color-chip').each(function () {
@ -793,10 +798,10 @@ var ThemeOptions = function () {
var mode = String(chip.data('mode'));
var c = currentColor(presets[mode]);
chip.css('background', c || 'transparent');
chip.text(c || '');
chip.attr('title', mode + (c ? ' [' + c + ']' : ''));
chip.attr('aria-label', chip.attr('title'));
chip.toggleClass('active', String(sel.val()) === mode);
chip.siblings('.color-chip-label').first().text(c || '');
});
};
var refreshEffective = function () {