gilbarbara / react-joyride

Create guided tours in your apps
https://react-joyride.com/
MIT License
6.62k stars 519 forks source link

Overlay is not full height #1031

Open GabiLlvs opened 1 month ago

GabiLlvs commented 1 month ago

🐛 Bug Report

When you zoom I'm having this weird bug where I scroll down and the overlay sets amid the background color and the normal page size image

Link to repl or repo (highly encouraged)

This is are my styles:

const joyrideStyles = {
    options: {
        zIndex: 10000,
        primaryColor: theme.palette.primary.dark,
        disableScrolling: true,
        textColor: '#1E1E1E',
    },
    buttonNext: {
        backgroundColor: theme.palette.primary.dark,
        color: '#1E1E1E',
    },
    buttonBack: {
        // backgroundColor: theme.palette.warning.dark,
        color: '#1E1E1E',
    },
    overlay: { 
        height: '100vh'
    },
};
gilbarbara commented 1 month ago

Hey @GabiLlvs Can you try v2.8.2 and let me know if it works for you?

gilbarbara commented 1 month ago

And remember to remove the overlay.height from the styles. The height is set dynamically, so it has no effect.

gburatti commented 1 month ago

@gilbarbara. I have the same problem, tried with v2.8.2 and overlay.height removed. Still no luck.

@GabiLlvs I had a similar problem caused by my app having body height 100% of viewport and letting the content scroll inside. I managed to solve this using

    overlay: { 
        height: document.body.scrollHeight
    },

Hope this helps.

gilbarbara commented 1 month ago

@gburatti Having a custom scroll element (in your case, the body) is difficult to support since there are so many ways people can do it.

The function I use to get the document height includes the body.height, so I can't know what's going on with a reproducible example.

mtr1990 commented 1 month ago

Same problem with latest version.

In version "react-joyride": "^2.7.1" everything still works fine.

There are 2 solutions to fix this problem:

1. with css

body {
  min-height: 100vh;
}

2. with useEffect

  useEffect(() => {
    if (!run) {
      return;
    }

    document.body.style.height = 'auto';
    document.body.style.minHeight = '100vh';

    // eslint-disable-next-line consistent-return
    return () => {
      document.body.style.height = '';
      document.body.style.minHeight = '';
    };
  }, [run]);

  const setHelpers = (storeHelpers: StoreHelpers) => {
    helpers.current = storeHelpers;
  };

  const onCallback = (data: CallBackProps) => {
    const { status } = data;

    const finishedStatuses: string[] = [STATUS.FINISHED, STATUS.SKIPPED];

    if (finishedStatuses.includes(status)) {
      setRun(false);
    }
  };
gilbarbara commented 1 month ago

Hey @mtr1990

Can you please post a minimal reproducible example on codesandbox or stackblitz?

mtr1990 commented 1 month ago

Hi @gilbarbara

You an check :

https://codesandbox.io/p/devbox/elated-hofstadter-gwjt2g?file=%2Fsrc%2FBasic%2Findex.tsx%3A30%2C14&workspaceId=5ba1f6d5-7206-4894-9388-5f8eabfc1fff

Please check file : src/Basic/styles.css

html,
body {
  height: 100%;
}
gilbarbara commented 1 month ago

@mtr1990 The link isn't working, maybe the sandbox is private?

Try changing the height to min-height.

Yash-pede commented 1 month ago

@gilbarbara. I have the same problem, tried with v2.8.2 and overlay.height removed. Still no luck.

@GabiLlvs I had a similar problem caused by my app having body height 100% of viewport and letting the content scroll inside. I managed to solve this using

  overlay: { 
      height: document.body.scrollHeight
  },

Hope this helps.

@gilbarbara I have same problem and the document.body.scrollHeight is not working for me nor the https://github.com/gilbarbara/react-joyride/issues/1031#issuecomment-2130063435 can anybody please help Screenshot_20240527_011524

gilbarbara commented 1 month ago

Hey @Yash-pede

Can you please post a minimal reproducible example on stackblitz or codesandbox?