fix(views): row 201 — emit the border-radius values as-is (they already carry px/rem)

The duration options store e.g. "5px", but custom_header.twig appended
"px" again, rendering border-radius: 5pxpx ... — invalid, so the browser
dropped the declaration and no radius showed in the survey. Values are
now emitted unchanged, with a ^<number>(px|rem)$ guard falling back to
5px (regex written backslash-free: [0-9], [.]). Verified live: 5px renders,
1.5rem renders, invalid values fall back to 5px.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-29 16:54:28 +01:00
commit 931d61b13d

View file

@ -159,16 +159,30 @@
} }
{% endif %} {% endif %}
{# Row 201: the border radii are duration options — the stored value already
carries the unit ("5px", "0.5rem"), so emit it AS-IS. (Appending "px" here
rendered "5pxpx" — an invalid declaration the browser silently drops, so no
radius showed in the survey at all.) Values not matching <number>(px|rem)
fall back to 5px. The regex deliberately uses [0-9] and [.] instead of
backslash escapes to avoid twig-string/PCRE escaping pitfalls. #}
{% set sRadiusTL = aSurveyInfo.options.questionborderradiusTL|default('5px') %}
{% set sRadiusTR = aSurveyInfo.options.questionborderradiusTR|default('5px') %}
{% set sRadiusBR = aSurveyInfo.options.questionborderradiusBR|default('5px') %}
{% set sRadiusBL = aSurveyInfo.options.questionborderradiusBL|default('5px') %}
{% set sRadiusTL = sRadiusTL matches '/^[0-9]+([.][0-9]+)?(px|rem)$/' ? sRadiusTL : '5px' %}
{% set sRadiusTR = sRadiusTR matches '/^[0-9]+([.][0-9]+)?(px|rem)$/' ? sRadiusTR : '5px' %}
{% set sRadiusBR = sRadiusBR matches '/^[0-9]+([.][0-9]+)?(px|rem)$/' ? sRadiusBR : '5px' %}
{% set sRadiusBL = sRadiusBL matches '/^[0-9]+([.][0-9]+)?(px|rem)$/' ? sRadiusBL : '5px' %}
.question-container, .question-container,
#welcome-container, #welcome-container,
.save-form, .save-form,
#surveys-list-container, #surveys-list-container,
.privacy { .privacy {
border-radius: {{ aSurveyInfo.options.questionborderradiusTL }}px {{ aSurveyInfo.options.questionborderradiusTR }}px {{ aSurveyInfo.options.questionborderradiusBR }}px {{ aSurveyInfo.options.questionborderradiusBL }}px; border-radius: {{ sRadiusTL }} {{ sRadiusTR }} {{ sRadiusBR }} {{ sRadiusBL }};
} }
.question-title-container{ .question-title-container{
border-radius: {{ aSurveyInfo.options.questionborderradiusTL }}px {{ aSurveyInfo.options.questionborderradiusTR }}px 0 0; border-radius: {{ sRadiusTL }} {{ sRadiusTR }} 0 0;
} }
{% if (aSurveyInfo.options.questiondropdown == "on" ) %} {% if (aSurveyInfo.options.questiondropdown == "on" ) %}