Check labels styles

We are use a display: block style for labels containing check boxes inside
them, and the label has a width of 100%.

This means that clicking on the blank space on the right of the label text
will check/uncheck the checkbox. To avoid this behaviour we modify the
"display" attribute of the labels.

In order to prevent unexpected behaviour in terms_of_service form labels,
we add specific css for this case when define a checkbox within the
.actions class.
This commit is contained in:
taitus
2022-03-30 16:27:30 +02:00
parent f4887089bd
commit 923c2a7ee2
4 changed files with 23 additions and 2 deletions

View File

@@ -25,7 +25,10 @@ class ConsulFormBuilder < FoundationRailsHelper::FormBuilder
else
label = tag.span sanitize(label_text(attribute, options[:label])), class: "checkbox"
super(attribute, options.merge(label: label, label_options: label_options_for(options)))
super(attribute, options.merge(
label: label,
label_options: { class: "checkbox-label" }.merge(label_options_for(options))
))
end
end