Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions src/components/renderer/FormElementLabelContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,30 @@ function FormElementLabelContainer({
required,
children,
leading,
associateLabelWithInput = true,
associateLabelWithInput = true
}: {
className: string
element: FormTypes.FormElementBase
id: string
required: boolean
children: React.ReactNode
leading?: React.ReactNode
/** When false, render the title as a span (no htmlFor), e.g. repeatable sets with no single control. */
associateLabelWithInput?: boolean
}) {
const labelId = `${id}-label`
const labelClassName = clsx('ob-label', {
'ob-label__required is-required': required,
})

return (
<div className={clsx('ob-form__element', className)}>
<div className="label ob-label__container">
{leading}
{associateLabelWithInput ? (
<label className={labelClassName} htmlFor={id} id={labelId}>
{element.label}
</label>
) : (
<span className={labelClassName} id={labelId}>
{element.label}
</span>
)}
<label
className={clsx('ob-label', {
'ob-label__required is-required': required,
})}
htmlFor={associateLabelWithInput ? id : undefined}
id={`${id}-label`}
>
{element.label}
</label>
{element.hint &&
(element.hintPosition === 'TOOLTIP' || !element.hintPosition) && (
<HintTooltip hint={element.hint} inputId={id} />
Expand Down
2 changes: 2 additions & 0 deletions src/form-elements/FormElementRepeatableSet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ function FormElementRepeatableSet({
onAdd={() => handleAddEntry(0)}
element={element}
classes={['ob-button-repeatable-set-layout__multiple-add-buttons']}
id={id}
/>
)}
{entries.map((entry, index) => {
Expand Down Expand Up @@ -445,6 +446,7 @@ function FormElementRepeatableSet({
<AddButton
onAdd={() => handleAddEntry(entries.length)}
element={element}
id={id}
/>
)}
{(isDirty || displayValidationMessage) &&
Expand Down
Loading