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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user