zendeskgarden / react-components

:seedling: garden React components
https://zendeskgarden.github.io/react-components/
Apache License 2.0
1.1k stars 89 forks source link

Example in ButtonGroup docs crashes running under StrictMode #1162

Closed toddoglethorpe closed 1 year ago

toddoglethorpe commented 3 years ago

ButtonGroup's appear unable to work in React's strict mode. There's other issues in this repo mentioning problems running in strict mode, so perhaps this is already a known issue.

Expectation

Clicking a button in a ButtonGroup should select the button.

Reality

The component renders, but when clicking a button from the group a "Cannot read property 'focus' of null" error is thrown.

Steps to Reproduce

This is a codesandbox forked from the first ButtonGroup example in the docs with the only modification being that StrictMode is enabled.

https://codesandbox.io/s/vigorous-mendel-p3sip

AzySir commented 1 year ago

I'm getting a message on VS Code that this has been Deprecated but i can't find any docs anywhere to confirm

jzempel commented 1 year ago

@AzySir there is messaging to this affect under https://garden.zendesk.com/components/button-group. However, this does not negate the fact that Garden (Tabs component, dropdowns, etc.) is not yet tuned-up for React 18 with StrictMode. We know this needs to be addressed and it is on the roadmap.

AzySir commented 1 year ago

@jzempel thanks - sorry maybe a background colour for highlighting. Thanks for sharing !

jzempel commented 1 year ago

Fixed by #1576. Release coming soon.