react-joyride icon indicating copy to clipboard operation
react-joyride copied to clipboard

Support for a target with multiple elements.

Open InputNeuron opened this issue 7 years ago • 9 comments

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.

InputNeuron avatar Feb 22 '19 19:02 InputNeuron


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.

InputNeuron avatar Feb 22 '19 19:02 InputNeuron

Not sure I understand what you are proposing. You can have multiple steps for different targets...

gilbarbara avatar Feb 23 '19 08:02 gilbarbara

One step. Multiple targets. Usually they are clumped together

InputNeuron avatar Feb 23 '19 08:02 InputNeuron

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.

gilbarbara avatar Feb 23 '19 12:02 gilbarbara

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?

InputNeuron avatar Feb 23 '19 18:02 InputNeuron

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.

raykhenberg avatar Oct 02 '19 00:10 raykhenberg

How to make react joyride come on multiple screens?

unnatikala05 avatar May 08 '20 07:05 unnatikala05

so it is not possible to pass multiple elements to a single target?

ThadeuCesario avatar Feb 03 '21 00:02 ThadeuCesario

we need it tooo((((

NinaSekret avatar Apr 01 '22 06:04 NinaSekret