fix(options): bold the default color choice through every browser mechanism
Row 132: after cache clear + theme reset + hard refresh the default entry of
the color-chooser dropdown still was not bold in the owner's browser — not
every browser applies font-weight to <option> elements (Safari ignores option
styling entirely; the closed select box often ignores it too), even though
the data-default attribute and <b> were in the DOM. Now stacked:
1. CSS rule select option[data-default="1"] { font-weight: 700 } (existing),
2. a real <b> around the default label (row 129, existing),
3. inline style font-weight:700 on the default <option> (new in options.js),
4. .action_update_options_string_form select:has(option[data-default="1"]:checked)
{ font-weight: 700 } — bolds the CLOSED select box when the default choice
is selected (new in options.twig inline <style>),
5. the swatch chip label of the default stays bold via .is-default (row 126).
Also: the default mode is now read with a fallback chain (data-default option
-> data-inheritvalue -> first non-inherit option) so the swatch label bold
cannot silently disappear. OPTIONS_JS_TOKEN -> 20261126.11. Verified: render
tc=618 (served as options.js?v=20261126.11, :has rule present in HTML), jsdom
6/6 incl. new pins (inline font-weight on the default option only, :has rule
in the inline style), export exit 0. Variants not rebuilt (deferred).
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
1a60918630
commit
4d5dd1e746
2 changed files with 22 additions and 5 deletions
|
|
@ -754,10 +754,16 @@ var ThemeOptions = function () {
|
||||||
// "Default background color" is the SECOND choice, right after "Same as
|
// "Default background color" is the SECOND choice, right after "Same as
|
||||||
// default font color".
|
// default font color".
|
||||||
var presets = { 'default': 'fontcolor', 'defaultbackgroundcolor': 'defaultbackgroundcolor', 'color1': 'primarycolor', 'color2': 'secondarycolor', 'color3': 'tertiarycolor' };
|
var presets = { 'default': 'fontcolor', 'defaultbackgroundcolor': 'defaultbackgroundcolor', 'color1': 'primarycolor', 'color2': 'secondarycolor', 'color3': 'tertiarycolor' };
|
||||||
// row 126: the option's DEFAULT choice — the config.xml <option data-default="1">
|
// row 126/132: the option's DEFAULT choice — the config.xml <option data-default="1">
|
||||||
// (same value as the <default> element text). Shown bold in the dropdown by
|
// (same value as the <default> element text). Shown bold via every mechanism
|
||||||
// CSS (select option[data-default="1"]) and on the swatch label (is-default).
|
// available, because browsers differ: CSS on the option + a real <b> + inline
|
||||||
var defaultMode = String(sel.find('option[data-default="1"]').first().attr('value') || '');
|
// style (row 132) for the popup, :has() rule for the CLOSED select box, and the
|
||||||
|
// is-default class on the swatch label. Fallback when the marker is missing:
|
||||||
|
// the inherited value, else the first non-"inherit" entry.
|
||||||
|
var defaultMode = String(sel.find('option[data-default="1"]').first().attr('value')
|
||||||
|
|| sel.data('inheritvalue')
|
||||||
|
|| sel.find('option').not('[value="inherit"]').first().attr('value')
|
||||||
|
|| '');
|
||||||
var customInput = globalForm.find('input[name="navbarfontcolorcustom"]');
|
var customInput = globalForm.find('input[name="navbarfontcolorcustom"]');
|
||||||
var currentColor = function (key) {
|
var currentColor = function (key) {
|
||||||
var f = globalForm.find('#simple_edit_options_' + key);
|
var f = globalForm.find('#simple_edit_options_' + key);
|
||||||
|
|
@ -775,6 +781,11 @@ var ThemeOptions = function () {
|
||||||
sel.find('option').each(function () {
|
sel.find('option').each(function () {
|
||||||
var op = $(this);
|
var op = $(this);
|
||||||
var mode = String(op.attr('value'));
|
var mode = String(op.attr('value'));
|
||||||
|
if (op.attr('data-default')) {
|
||||||
|
// row 132: inline style as well — some browsers only honour the
|
||||||
|
// inline style on <option>, not the stylesheet rule
|
||||||
|
op.css('font-weight', '700');
|
||||||
|
}
|
||||||
if (!op.data('base-label')) { op.data('base-label', op.text()); }
|
if (!op.data('base-label')) { op.data('base-label', op.text()); }
|
||||||
var base = String(op.data('base-label'));
|
var base = String(op.data('base-label'));
|
||||||
var pk = presets[mode];
|
var pk = presets[mode];
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
heuristically cached copy (the file has only Last-Modified/ETag, no Cache-Control).
|
heuristically cached copy (the file has only Last-Modified/ETag, no Cache-Control).
|
||||||
Re-register it with a version token: bump OPTIONS_JS_TOKEN below whenever
|
Re-register it with a version token: bump OPTIONS_JS_TOKEN below whenever
|
||||||
options/options.js changes, so every browser fetches the new file once. #}
|
options/options.js changes, so every browser fetches the new file once. #}
|
||||||
{% set OPTIONS_JS_TOKEN = '20261126.10' %}
|
{% set OPTIONS_JS_TOKEN = '20261126.11' %}
|
||||||
{{ unregisterScriptFile(optionsPath ~ '/options.js') }}
|
{{ unregisterScriptFile(optionsPath ~ '/options.js') }}
|
||||||
{{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }}
|
{{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }}
|
||||||
|
|
||||||
|
|
@ -160,6 +160,12 @@
|
||||||
select option[data-default="1"] {
|
select option[data-default="1"] {
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
/* row 132: also bold the CLOSED select box when the default choice is the
|
||||||
|
selected one (the popup alone is not enough — some browsers ignore option
|
||||||
|
styling in the closed box) */
|
||||||
|
.action_update_options_string_form select:has(option[data-default="1"]:checked) {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
.color-chip-label.is-default {
|
.color-chip-label.is-default {
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #212529;
|
color: #212529;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue