React-dates: position absolute on Week headers places them on top of everything.

Created on 12 Nov 2018  路  5Comments  路  Source: airbnb/react-dates

I am using custom month and and year drop downs or DayPickerSingleDateController. Week headers are inside one wrapper(div) and rest of the calendar inside another wrapper(div). Week headers are absolute positioned and they are always on top of everything. So when the drop down is open, the week headers are on top of them. Here's an image:

screen shot 2018-11-11 at 10 17 15 pm

I have tried almost everything but can't make it work.

Most helpful comment

I set the follow css. It is work for me.

.CalendarMonthGrid {
  z-index: 2;
  background: transparent;
}

.CalendarMonth {
  background: transparent;
}

If want to click the navigation. Should add extra css.

.DayPickerNavigation {
  z-index: 3;
}

All 5 comments

This is because z-index of Week div is greater than the calendar div to make week headers visible as week div is absolute positioned . There is way to solve it not sure this is the right way but it will work. You need to increase the z-index of calendar wrapper but this will change the stacking context and week div will get hide behind calendar wrapper. So to make week header visible, you need to make background-color of calendar wrapper transparent.hope this helps :)

@deep-coder I have tried that before. I have played around with z-index a lot but doesn't seem to work.

I set the follow css. It is work for me.

.CalendarMonthGrid {
  z-index: 2;
  background: transparent;
}

.CalendarMonth {
  background: transparent;
}

If want to click the navigation. Should add extra css.

.DayPickerNavigation {
  z-index: 3;
}

@jessy1092 sweet! It works. Thanks!

.CalendarMonth {
background: transparent;
}

Thanks so much, saved me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brunocoelho picture brunocoelho  路  28Comments

AntiFish03 picture AntiFish03  路  19Comments

comron picture comron  路  22Comments

easwee picture easwee  路  55Comments

Jucesr picture Jucesr  路  19Comments