0

I am trying to show a basic tooltip when the user clicks on an event in the calendar with a few event details but the tooltip gets covered by the next row.

Currently, I'm trying to use the slotPropGetter prop to change the style of a cell to include z-index: -1 and inline-styling the tooltip with z-index: 1000 but to no avail.

Here's my current component:

    export default() =>{
    const eventStyleGetter = ({ color }) => {
        const style = {
            backgroundColor: color,
            opacity: 0.8,
            zindex: "6",
            position:"relative",
        };
        return {
          style: style,
        };
      };
     const slotStyleGetter = () =>{
      const style = {
          position: "relative",
          zindex:0,
          height:"100px",
          
      }
      return{
          style: style
      }
  }
      const CalendarElement = (
        <Calendar
          localizer={localizer}
          defaultDate={new Date()}
          events={events}
          style={{ height: 500 }}
          eventPropGetter={(event) => eventStyleGetter(event)}
          slotPropGetter={(slot) => slotStyleGetter(slot)}
          onSelectSlot={(e) => handleSlotSelect(e)}
          selectable
          popup
          components={{
            event: EventPopover,
          }}
        />
      );
    
    return(
       {CalendarElement}
    )
    }
Amartya Mishra
  • 145
  • 3
  • 7

2 Answers2

1

The issue isn't the cell z-index, but that of your tooltip. What are you using to render your tooltip? Under the hood, RBC has react-bootstrap@^0.32.4, which uses react-overlay@^0.8.0. If you use react-overlay to create your tooltips, you can portal them, which should automatically handle your z-index issue.

Steve -Cutter- Blades
  • 5,057
  • 2
  • 26
  • 40
0

The way to correctly implement this is to use Reactstrap/Bootstrap Popover (based on Popperjs) rather than plain CSS. It worked in this case.

Amartya Mishra
  • 145
  • 3
  • 7