Skip to content

ToggleGroupControl: Remove invalid props from types#45114

Merged
mirka merged 3 commits intotrunkfrom
fix/toggle-group-types
Oct 20, 2022
Merged

ToggleGroupControl: Remove invalid props from types#45114
mirka merged 3 commits intotrunkfrom
fix/toggle-group-types

Conversation

@mirka
Copy link
Member

@mirka mirka commented Oct 19, 2022

Extracted from #44168

What?

  • From the ToggleGroupControl prop types, removes the label and disabled props picked from the FormElementProps type.
  • Removes the FormElementProps utility type altogether.

Why?

  • FormElementProps[ 'label' ] was marked as optional, and was overriding the explicitly required label prop defined in ToggleGroupControlProps itself.
  • ToggleGroupControl does not properly support a disabled prop in its current form.

The FormElementProps is kind of unnecessary at the moment, so I think we should remove it for now.

Testing Instructions

npm run storybook:dev and see the props table for ToggleGroupControl. The disabled prop should be gone, and the label prop should now be correctly marked as required.

@mirka mirka added the [Package] Components /packages/components label Oct 19, 2022
@mirka mirka requested review from chad1008 and ciampo October 19, 2022 13:14
@mirka mirka requested a review from ajitbohra as a code owner October 19, 2022 13:14
@mirka mirka self-assigned this Oct 19, 2022
@codesandbox
Copy link

codesandbox bot commented Oct 19, 2022

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually the first time that I see the FormElementProps type!

Anyway, nice finding! 🚀

@mirka mirka merged commit b449181 into trunk Oct 20, 2022
@mirka mirka deleted the fix/toggle-group-types branch October 20, 2022 10:02
@github-actions github-actions bot added this to the Gutenberg 14.5 milestone Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Components /packages/components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants