Replies: 1 comment
-
We have contemplated opening createBranchComponent in the same way as createLeafComponent. I think I explored in in a PR at one point. This one https://github.com/adobe/react-spectrum/pull/7289/files We'll likely have to solve something similar when we get to Coachmarks as well. I know an approach we've used in the past has been to render the overlays separately, and position them by finding the target in the dom. We'd also like to avoid that because it typically means needing to implement polling and retry logic, but it could work for now. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
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