From fc21305b81f73cd80a4c729cf19865274d80be9d Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 17 Oct 2025 17:33:36 +0200 Subject: [PATCH] Fix conflicting id attributes in forms --- www/form/inner.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/www/form/inner.js b/www/form/inner.js index 47fe2b1fb..32457fa03 100644 --- a/www/form/inner.js +++ b/www/form/inner.js @@ -752,7 +752,7 @@ define([ } var day = _date && allDays[_date.getDay()]; return h('div.cp-poll-cell.cp-form-poll-option', { - id: 'cp-form-option-' + index, + 'data-index': index, title: data, }, [ opts.type === 'day' ? h('span.cp-form-weekday', day) : undefined, @@ -1067,6 +1067,8 @@ define([ APP.common.openUnsafeURL(href); }; + const pollLabels = [Messages.forms_pollOptionNo, Messages.forms_pollOptionYes, Messages.forms_pollOptionMaybe]; + var STATIC_TYPES = { md: { defaultOpts: { @@ -2659,9 +2661,9 @@ define([ var disabled = false; var updateAriaLabel = function ($c, val, index) { - const labels = [Messages.forms_pollOptionNo, Messages.forms_pollOptionYes, Messages.forms_pollOptionMaybe]; - const currentLabelText = $('#cp-form-option-' + index).text().trim(); - $c.attr('aria-label', currentLabelText + ', ' + labels[val]); + //const currentLabelText = $('#cp-form-option-' + index).text().trim(); + const optionLabel = $c.closest('.cp-form-type-poll').find(`.cp-form-poll-option[data-index=${index}] span`).text().trim(); + $c.attr('aria-label', optionLabel + ', ' + pollLabels[val]); }; // Add form var addLine = extractValues(opts.values).map(function (data,index) {