springload / react-accessible-accordion

Accessible Accordion component for React
https://springload.github.io/react-accessible-accordion
MIT License
787 stars 113 forks source link

Preparing React Accessible Accordion for React 18 #341

Closed holloway closed 2 years ago

holloway commented 2 years ago

It seems that broadly speaking it will be compatible, but our generated ids will have to use the useId hook,

it's even more important in React 18 because of how our streaming server renderer delivers HTML out-of-order. Solutions that may have worked previously, like using a counter to generate IDs, don't work in 18.0 because you can't rely on a consistent sequence. (cite)

We were using the counter to generate IDs approach, so we'll have to adopt useId.

Because we have React as a peerDep we'll have to detect if useId is available and fallback to our existing counter approach.

As such these autogenerated ids will change in a release of RAA for React 18.

Are there any other issues that we should address for React 18?

trigunam commented 2 years ago

We are also looking for React 18 support for accordions. @holloway is there a plan to merge this PR #342?

holloway commented 2 years ago

@trigunam yes, within a week if testing goes well.

holloway commented 2 years ago

@trigunam This has been published as 5.0.0. Please let me know if this works for you.

trigunam commented 2 years ago

It's working now. Thank you @holloway

holloway commented 2 years ago

Great, thanks!