dcripplinger
dcripplinger

Reputation: 135

react-datepicker why is same day of month highlighted?

If you look at the default example of react-datepicker on their website reactdatepicker.com, you'll see that as you click through different months there is always a day of that month colored blue, which happens to correspond to the day of the month of the selected date. Is this a bug, or some weird feature nobody wants? How do I get rid of it? I looked over the docs and haven't found anything.

Upvotes: 2

Views: 1999

Answers (1)

lu03566
lu03566

Reputation: 199

Update After realized this issue is related to some "keyboard-selected" function then I did a quick search and found out we can fix this problem by disable the keyboard navigation. (If you don't need the keyboard navigation feature)

<DatePicker 
  selected={startDate} 
  onChange={date => setStartDate(date)}
  disabledKeyboardNavigation
/>

Not sure why it is happening after 2.14.1 version but here is a quick fix. Applying the following style to your css file to override the style.

.react-datepicker__day--keyboard-selected {
    border-radius: 0; 
    background-color: #FFF;
    color: #000;
}

Add !important if not working.

Upvotes: 4

Related Questions