Search code examples
reactjstooltipfullscreenreact-bootstrap

React Bootstrap Tooltip is not working on full screen


I have used the "Tooltip" tag that comes with React Bootstrap React Bootstrap Tooltip and OverlayTrigger. The code works well. However, when my app becomes fullscreen, I don't see the tool tips anymore. I am using React and React Bootstrap.

This is the code for making the app fullscreen

if (elem.requestFullscreen) {
            elem.requestFullscreen();
        } else if (elem.mozRequestFullScreen) { /* Firefox */
            elem.mozRequestFullScreen();
        } else if (elem.webkitRequestFullscreen) { /* Chrome, Safari & Opera */
            elem.webkitRequestFullscreen();
        } else if (elem.msRequestFullscreen) { /* IE/Edge */
            elem.msRequestFullscreen();
        }

And this is my tooltip

<OverlayTrigger
                    placement="top"
                    delay={{show: 250, hide: 400}}
                    overlay={DisplayTooltip(this.props)}>
                    <button onClick={(evt) => {
                        this.itemOnClick(evt)
                    }}>
                        {
                        <img src={this.props.icon} />
                    </button>
                </OverlayTrigger>

And the tooltip:

const DisplayTooltip = (props) => {
    return (
        <Tooltip id={props.tooltip_type + "button-tooltip"} {...props} appendTo>{props.tooltip_type}</Tooltip>
    );
}

Many thanks


Solution

  • Well, my colleague found a good solution that is working for the full screen issue. Now the tooltip is working fine

    The solution is:

    if (document.body.requestFullscreen) {
       document.body.requestFullscreen();
    } else if (document.body.mozRequestFullScreen) { /* Firefox */
      document.body.mozRequestFullScreen();
    } else if (document.body.webkitRequestFullscreen) { /* Chrome, Safari & Opera */
      document.body.webkitRequestFullscreen();
    } else if (document.body.msRequestFullscreen) { /* IE/Edge */
      document.body.msRequestFullscreen();
    }