You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found this bug while trying out useOpaqueIdentifier on a component that uses aria-activedescendant. It works great on a CRA app, but it breaks on server rendered apps.
The way it's implemented is that each item registers its id into a state up in the tree so the container element can get the active id and render it on the aria-activedescendant prop.
Steps To Reproduce
Create a simple server rendered app (for example, using Next.js).
Create a component that uses React.unstable_useOpaqueIdentifier and passes the generated object to a component up in the tree through callbacks.
Try to render the generated ID to a prop in the ancestor component.
I guess this workaround can also be used for ID lists.
I wonder if it's technically possible to improve the useOpaqueIdentifier hook so it works similarly to element refs. That is, their value should be accessible within effects and event callbacks after they're rendered to the DOM.
React version: experimental
I found this bug while trying out
useOpaqueIdentifier
on a component that usesaria-activedescendant
. It works great on a CRA app, but it breaks on server rendered apps.The way it's implemented is that each item registers its id into a state up in the tree so the container element can get the active id and render it on the
aria-activedescendant
prop.Steps To Reproduce
React.unstable_useOpaqueIdentifier
and passes the generated object to a component up in the tree through callbacks.Link to code example:
https://codesandbox.io/s/react-useopaqueidentifier-aria-activedescendant-bug-geutb?file=/pages/index.js:0-412
The current behavior
It throws an error:
I believe it's triggered here:
react/packages/react-dom/src/client/ReactDOMComponent.js
Lines 786 to 789 in 993ca53
The expected behavior
It works well when not using SSR:
https://codesandbox.io/s/react-useopaqueidentifier-aria-activedescendant-y3f22
The text was updated successfully, but these errors were encountered: