Mount rich-text editor outside the label to stop label clicks triggering the bold button

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Claude Fable 5
2026-08-22 10:02:15 +02:00
parent 43e155bb72
commit f181ab4f75
2 changed files with 18 additions and 1 deletions
+8
View File
@@ -1358,3 +1358,11 @@
font-weight: 400;
font-style: normal;
}
.survey-label--rich-text {
margin-bottom: -0.35rem;
}
.survey-label--rich-text + .survey-rich-editor {
margin-bottom: 0.4rem;
}
+10 -1
View File
@@ -35,7 +35,16 @@
editorHost.className = 'survey-rich-editor__host';
wrapper.appendChild(editorHost);
textarea.parentNode.insertBefore(wrapper, textarea);
// Nicht innerhalb eines <label> platzieren: Ein Klick ins Label aktiviert
// dessen erstes bedienbares Element das wäre der erste Toolbar-Button (Fett).
var label = textarea.closest('label');
if (label) {
label.parentNode.insertBefore(wrapper, label.nextSibling);
label.classList.add('survey-label--rich-text');
} else {
textarea.parentNode.insertBefore(wrapper, textarea);
}
textarea.hidden = true;
textarea.setAttribute('aria-hidden', 'true');
textarea.tabIndex = -1;