Skip to content
Snippets Groups Projects
Commit 0b38b847 authored by Sascha Eggenberger's avatar Sascha Eggenberger Committed by Sascha Eggenberger
Browse files

Set correct id on label for attribute

parent 61e9cf2e
No related branches found
No related tags found
1 merge request!349Set correct id on label for attribute
Pipeline #66709 failed
......@@ -5,10 +5,12 @@
const sticky = context.querySelector(".gin-sticky"), newParent = context.querySelector(".region-sticky__items__inner");
if (newParent && 0 === newParent.querySelectorAll(".gin-sticky").length) {
newParent.appendChild(sticky);
const actionButtons = newParent.querySelectorAll("button, input, select, textarea");
actionButtons.length > 0 && actionButtons.forEach((el => {
const actionButtons = newParent.querySelectorAll("button, input, select, textarea"), formLabels = newParent.querySelectorAll("label");
actionButtons.length > 0 && (actionButtons.forEach((el => {
el.setAttribute("form", form.getAttribute("id")), el.setAttribute("id", el.getAttribute("id") + "--gin-edit-form");
}));
})), formLabels.forEach((el => {
el.setAttribute("for", el.getAttribute("for") + "--gin-edit-form");
})));
}
}));
}
......
......@@ -14,12 +14,17 @@
// Attach form elements to main form
const actionButtons = newParent.querySelectorAll('button, input, select, textarea');
const formLabels = newParent.querySelectorAll('label');
if (actionButtons.length > 0) {
actionButtons.forEach((el) => {
el.setAttribute('form', form.getAttribute('id'));
el.setAttribute('id', el.getAttribute('id') + '--gin-edit-form');
});
formLabels.forEach((el => {
el.setAttribute('for', el.getAttribute('for') + '--gin-edit-form');
}));
}
}
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment