Skip to content

Commit

Permalink
Merge pull request #4105 from mathesar-foundation/4091_fieldset_legend
Browse files Browse the repository at this point in the history
Fix fieldset legend displaying undefined
  • Loading branch information
pavish authored Jan 6, 2025
2 parents fbfb7d3 + 0fca495 commit 045f582
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@
checked={values.some((o) => valuesAreEqual(o, option))}
disabled={innerDisabled}
/>
<slot name="label" slot="label">{label}</slot>
<slot name="label" slot="label">{label ?? ''}</slot>
</FieldsetGroup>
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</script>

<Fieldset {ariaLabel} {boxed}>
<slot name="label" slot="label">{label}</slot>
<slot name="label" slot="label">{label ?? ''}</slot>
<ul
class="fieldset-group-options"
class:inline={isInline}
Expand Down
12 changes: 2 additions & 10 deletions mathesar_ui/src/component-library/fieldset/Fieldset.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@
export let boxed = false;
</script>

<fieldset
class="fieldset"
class:boxed
class:has-label={!!label}
aria-label={ariaLabel}
on:change
>
{#if $$slots.label || label}
<legend><slot name="label">{label}</slot></legend>
{/if}
<fieldset class="fieldset" class:boxed aria-label={ariaLabel} on:change>
<legend><slot name="label">{label ?? ''}</slot></legend>
<slot />
</fieldset>
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@
dispatch('change', { value: option });
}}
/>
<slot slot="label" name="label">{label}</slot>
<slot slot="label" name="label">{label ?? ''}</slot>
<slot slot="extra" name="extra" />
</FieldsetGroup>

0 comments on commit 045f582

Please sign in to comment.