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
Hi there! 👋
I'm working on the onboarding React component which will guide a user through the app by highlighting parts of the interface. Let’s call this component an <OnboardingHighlight /> that wraps child nodes in a new <div> with custom styles and props like onFocus to prevent conflict with children components which also have a onFocus prop.
Visual example of what I want to achieve with a <OnboardingHighlight /> akin to the React Joyride
<OnboardingHighlight /> works great with regular components, but when it comes to collections, there are a bunch of problems. To make it work as intended with collections components, I can add a special property getCollectionNode (like in TooltipTrigger) to the component with a "wrapper" in the result object. Via this "wrapper", I can define how collection keys will be handled and elements are rendered. But it works only if I'm creating a collection via useCollection and passing it to the CollectionBuilder from "react-stately".
But there’s another CollectionBuilder from a "@react-aria/collections", which works very differently. In order to make <OnboardingHighlight /> work with these collections, I need to wrap it either in createLeafComponent or createBranchComponent. However, neither of them has a "wrapper" support like the one defined in getCollectionNode, leading to another set of problems:
If I use createLeafComponent with 2 parameters, the component can be used both in and outside collections. But if <OnboardingHighlight /> have a child leaf component like TabItem, TabItem won’t be present in the collection object and will only be accessible via node.props.children;
If I use createBranchComponent there’s no problem rendering child leaf components, but it becomes impossible to use <OnboardingHighlight /> outside collections because it results in a JS error.
Is there any way to achieve desired behaviour with a "wrapper" from getCollectionNode in the new CollectionBuilder from a "@react-aria/collections"? 🤔
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi there! 👋
I'm working on the onboarding React component which will guide a user through the app by highlighting parts of the interface. Let’s call this component an
<OnboardingHighlight />
that wraps child nodes in a new<div>
with custom styles and props likeonFocus
to prevent conflict with children components which also have aonFocus
prop.Visual example of what I want to achieve with a
<OnboardingHighlight />
akin to the React Joyride<OnboardingHighlight />
works great with regular components, but when it comes to collections, there are a bunch of problems. To make it work as intended with collections components, I can add a special propertygetCollectionNode
(like in TooltipTrigger) to the component with a "wrapper" in the result object. Via this "wrapper", I can define how collection keys will be handled and elements are rendered. But it works only if I'm creating a collection viauseCollection
and passing it to theCollectionBuilder
from "react-stately".But there’s another
CollectionBuilder
from a "@react-aria/collections", which works very differently. In order to make<OnboardingHighlight />
work with these collections, I need to wrap it either increateLeafComponent
orcreateBranchComponent
. However, neither of them has a "wrapper" support like the one defined ingetCollectionNode
, leading to another set of problems:createLeafComponent
with 2 parameters, the component can be used both in and outside collections. But if<OnboardingHighlight />
have a child leaf component likeTabItem
,TabItem
won’t be present in the collection object and will only be accessible vianode.props.children
;createBranchComponent
there’s no problem rendering child leaf components, but it becomes impossible to use<OnboardingHighlight />
outside collections because it results in a JS error.Is there any way to achieve desired behaviour with a "wrapper" from
getCollectionNode
in the newCollectionBuilder
from a "@react-aria/collections"? 🤔Beta Was this translation helpful? Give feedback.
All reactions