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

Uncaught TypeError: Invalid parameter: element must be an HTMLElement

Open brijeshlakkad opened this issue 6 years ago • 6 comments

const TooltipBody = styled.div`
  background-color: #daa588;
  min-width: 290px;
  max-width: 420px;
  padding-bottom: 3rem;
`;

const TooltipContent = styled.div`
  color: #fff;
  padding: 20px;
`;

const TooltipTitle = styled.h2`
  color: #fff;
  padding: 20px;
  margin: 0;
`;

const TooltipFooter = styled.div`
  background-color: #f56960;
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;

  * + * {
    margin-left: 0.5rem;
  }
`;

const Button = styled.button`
  background-color: #e11b0e;
  color: #fff;
`

const Input = styled.input`
  padding: 1.2rem;
  width: 75%;
`;

const Tooltip = ({
    continuous,
    backProps,
    closeProps,
    index,
    primaryProps,
    setTooltipRef,
    step,
    tooltipProps
}) => (
        <TooltipBody ref={setTooltipRef} {...tooltipProps}>
            {step.title && <TooltipTitle>{step.title}</TooltipTitle>}
            {step.content && <TooltipContent>{step.content}</TooltipContent>}
            <TooltipFooter>
                {index > 0 && (
                    <Button {...backProps}>
                        <FormattedMessage
                            defaultMessage="Back"
                            description="Button to go back during the tour"
                            id="gui.tour.back" />
                    </Button>
                )}
                {continuous && (
                    <Button {...primaryProps}>
                        <FormattedMessage 
                            defaultMessage="Next"
                            description="Button to go to the next step during the tour"
                            id="gui.tour.next" />
                    </Button>
                )}
                {!continuous && (
                    <Button {...closeProps}>
                        <FormattedMessage 
                            defaultMessage="Close"
                            description="Button to close the tour"
                            id="gui.tour.close" />
                    </Button>
                )}
            </TooltipFooter>
        </TooltipBody>
    );

And part where react-joyride have been imported as Joyride

<Joyride
  steps={steps}
  run={run}
  callback={this.handleJoyrideCallback}
  stepIndex={stepIndex}
  disableOverlay={false}
  continuous
  tooltipComponent={Tooltip}
  showSkipButton
/>


I am getting an error when I start tour:

Uncaught TypeError: Invalid parameter: element must be an HTMLElement
    at new Scope (lib.min.js:157442)
    at JoyrideStep.componentDidUpdate (lib.min.js:158408)
    at commitLifeCycles (lib.min.js:143293)
    at commitAllLifeCycles (lib.min.js:144461)
    at HTMLUnknownElement.callCallback (lib.min.js:135057)
    at Object.invokeGuardedCallbackDev (lib.min.js:135096)
    at invokeGuardedCallback (lib.min.js:134953)
    at commitRoot (lib.min.js:144565)
    at performWorkOnRoot (lib.min.js:145532)
    at performWork (lib.min.js:145482)

brijeshlakkad avatar Dec 10 '19 12:12 brijeshlakkad

@gilbarbara can you please look at this error? Thanks

brijeshlakkad avatar Dec 10 '19 12:12 brijeshlakkad

Please provide a https://codesandbox.io/ demo or similar.

Issues without a reproduction link are likely to stall.

gilbarbara avatar Dec 14 '19 21:12 gilbarbara

~~Just want to say I'm running into the same issue. A little too busy to create a reproduction right now, but in my case it's using a mounted modal and an Ant Design button as the target. I will dig in a bit more and see what I can find.~~

Edit: Nevermind, the issue was my stepIndex being incorrectly set.

drj17 avatar Jan 03 '20 17:01 drj17

Was there a solution to this issue? I am getting the same error

Onokaev avatar Sep 19 '21 10:09 Onokaev

Try to pass a tooltip ref in the element. image

vladislavkorenik avatar Feb 17 '23 13:02 vladislavkorenik

it helped me too

rafaelsevla avatar Apr 11 '23 13:04 rafaelsevla