Fix conflicting id attributes in forms

This commit is contained in:
yflory 2025-10-17 17:33:36 +02:00
parent 4f834ce5e8
commit fc21305b81

View File

@ -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) {