question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SingleDatePicker misaligned

See original GitHub issue

Hi guys, thanks for maintaining this great lib.

I’m facing this UI issue though:

I don’t know why a left property is being applied to my calendar. left: -292.984px;

screen shot 2017-01-12 at 4 04 36 pm screen shot 2017-01-12 at 4 04 58 pm screen shot 2017-01-12 at 4 05 05 pm

And it looks like the z-index is not working even though it uses z-index:1. My footer has position: absolute too and z-index:0;

I’m debugging it for quite a long time and I can’t see anything from my side interfering on the calendar.

I can workaround it applying left:0 to the calendar.

Maybe you guys have any thoughts?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
brunocoelhocommented, Jan 13, 2017

Hi @majapw I appreciate your attention, you don’t need to apologize, remote debugging is pretty hard.

a) screen shot 2017-01-13 at 3 33 11 pm

b) In order to fix the position and add some styling:

.deader .SingleDatePicker {
  display: block;
}

.deader .SingleDatePicker .SingleDatePickerInput {
  border: 1px solid #e5e6e7;
}

.deader .SingleDatePicker .SingleDatePickerInput .DateInput {
  color: #9a9a9a;
  font-size: 14px;
  width: auto;
}

.deader .SingleDatePicker__picker.SingleDatePicker__picker--show {
  left: 0 !important;
}

0reactions
majapwcommented, Jan 12, 2017

@brunocoelho That makes sense because what I expect the calculated style to be is left: 0 with your particular set-up.

Basically, on componentDidMount (and also whenever you resize the window), the inline styles that are applied get set here: https://github.com/airbnb/react-dates/blob/master/src/components/SingleDatePicker.jsx#L207:L212.

This is somewhat obfuscated but basically this file (https://github.com/airbnb/react-dates/blob/master/src/utils/getResponsiveContainerStyles.js) ends up setting the ANCHOR_DIRECTION value (in this case, left) of the picker based on the window width, and the this.dayPickerContainer.getBoundingClientRect() right value. In your case, for whatever reason the client rect right value is … larger than the window width. This may have something to do with how you’re styling the input to fill the space.

Can you share

(a) the value of document.querySelector('.SingleDatePicker__picker').getBoundingClientRect() (b) what styles you are applying to .DateRangePicker (or anything else) to get it to fill the width of your container?

Sorry for all the back and forth! I think we’re getting closer to a solution (and remote debugging is hard).

Read more comments on GitHub >

github_iconTop Results From Across the Web

SingleDatePicker misaligned · Issue #248 - GitHub
I don't know why a left property is being applied to my calendar. ... And it looks like the z-index is not working...
Read more >
Checkboxes on spreadsheet misaligned when sorting
Hi - I have a spreadsheet that's being populated from another sheet with data, checkboxes and date pickers. This is to enable tracking...
Read more >
SingleDatePicker by react-dates is not closing on change
How about trying this? According to its document, onFocusChange seems to should take { focused : boolean } objects as parameters. const ...
Read more >
Datepicker font control - Dash Python - Plotly Community Forum
DatepickerSingle and DatepickerRange are rendered with font size larger than Dropdown and Input. How to equalize these components font sizes?
Read more >
react-dates example, react date range picker, react-dates ...
A flexible date picker component for React, with no dependencies, fully customizable, localizable and with ARIA support. react-dates singledatepicker example.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found