I'd like to target multiple elements for tooltips.
If a selector turns one element that's fine. Just call getBoundingClientRect on it and it should work find.
If multiple are returned just compute the bounding client rect of all of them.
This is necessary if you have like a nav bar with multiple buttons that you'd like to highlight.
I can't create a new selector as some of the react libs we're using don't provide this functionality (react-table).
This is easy to do. Just take each boundingClientRect and merge them into a larger boundingClientRect.
I can post some sample code on how to do that if necessary.
left = Math.min(...rects.map( current => current.left));
right = Math.max(...rects.map( current => current.right));
top = Math.min(...rects.map( current => current.top));
bottom = Math.max(...rects.map( current => current.bottom));
... that would work.
Not sure I understand what you are proposing.
You can have multiple steps for different targets...
One step. Multiple targets. Usually they are clumped together
Nevermind...
I don't think this would work with small screen anyway so I'm closing this.
Feel free to fork this repo and add it yourself.
Why wouldn't this work for a small screen?
I have three buttons back to back that I need to highlight.
I can target them via:
".buttonA, buttonB, .buttonC"
It's easy to target them but just building the box around them.
I think maybe we aren't on the same page regarding this feature?
Not sure if anyone is still interested in this, but I wrote a gist for how I was able to solve this problem for my use case. We had a table and we wanted to highlight one or more columns and there was no good single selector to do it.
https://gist.github.com/raykhenberg/83581ece138c0079ed089b2048c4c14e
This adds a little bit of overhead, so we're only going to use it in cases where we need the multiselect capability, but it effectively just passes through the steps after determining the smallest overlay that encompasses all of them and attaches a transparent div which gets used as the anchor for any step.
How to make react joyride come on multiple screens?
so it is not possible to pass multiple elements to a single target?
Most helpful comment
Not sure if anyone is still interested in this, but I wrote a gist for how I was able to solve this problem for my use case. We had a table and we wanted to highlight one or more columns and there was no good single selector to do it.
https://gist.github.com/raykhenberg/83581ece138c0079ed089b2048c4c14e
This adds a little bit of overhead, so we're only going to use it in cases where we need the multiselect capability, but it effectively just passes through the steps after determining the smallest overlay that encompasses all of them and attaches a transparent div which gets used as the anchor for any step.