Skip to content

Commit

Permalink
fix(ToggleButtonGroup): omit rendering label when not given (#2929)
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker authored Nov 22, 2023
1 parent 01a01f4 commit 26f683e
Show file tree
Hide file tree
Showing 5 changed files with 494 additions and 445 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,13 @@ export default class ToggleButtonGroup extends React.PureComponent {
onChange: this.onChangeHandler,
}

const Fieldset = label ? 'fieldset' : 'div'

return (
<ToggleButtonGroupContext.Provider value={context}>
<div className={classes}>
<AlignmentHelper />
<fieldset>
<Fieldset>
<Flex.Container
align="baseline"
direction={
Expand All @@ -301,13 +303,15 @@ export default class ToggleButtonGroup extends React.PureComponent {
}
spacing={vertical ? 'x-small' : undefined}
>
<FormLabel
element="legend"
id={id + '-label'}
srOnly={label_sr_only}
>
{label}
</FormLabel>
{label && (
<FormLabel
element="legend"
id={id + '-label'}
srOnly={label_sr_only}
>
{label}
</FormLabel>
)}

<span
id={id}
Expand Down Expand Up @@ -343,7 +347,7 @@ export default class ToggleButtonGroup extends React.PureComponent {
</span>
</span>
</Flex.Container>
</fieldset>
</Fieldset>
</div>
</ToggleButtonGroupContext.Provider>
)
Expand Down
Loading

0 comments on commit 26f683e

Please sign in to comment.