material icon indicating copy to clipboard operation
material copied to clipboard

calendar: inside of menu does not properly scroll to the date

Open gatormike opened this issue 9 years ago • 3 comments

Actual Behavior:

  • What is the issue? When using md-calender inside of a md-menu-content, the initial render shows 1/1/1880
  • What is the expected behavior? The calendar should show the ng-model date.

CodePen (or steps to reproduce the issue): *

  • CodePen Demo which shows your issue: https://codepen.io/gatormike/pen/wrpmPN
  • Details: Click "Date Range" menu item. ng-model for each calendar is today's date, is reflected in label above calendar.

AngularJS Versions: *

  • AngularJS Version: 1.5.5
  • AngularJS Material Version: 1.1.5 (have tried each version since 1.1.0)

Additional Information:

  • Browser Type: * Chrome, FF
  • Browser Version: * Chrome 61.0.3163.100 , FF 47
  • OS: * Windows
  • Stack Traces: No error messages, just behavioral error.

2017-10-06_10-36-52

gatormike avatar Oct 06 '17 14:10 gatormike

I know there has to be an easy solution, I just can't figure it out. :(

gatormike avatar Oct 10 '17 19:10 gatormike

I tracked down the same issue that's happening in our code. As far as I can tell, the problem is occurring when the calendar is being scrolled to the current date. Setting a breakpoint in VirtualRepeatContainerController.prototype.scrollTo, you can see that the code tries to scroll to the current date by setting the scrollTop but right after scrollTop gets set, you can see that it is still 0. I thought it was not accepting a value for scrollTop because the clientHeight was set to 440540 and therefore scrolling was not necessary, but I couldn't get it to work even if I gave the scroller a fixed height.

aner-perez avatar Mar 21 '18 02:03 aner-perez

I was able to reproduce this in an updated CodePen for 1.1.8.

Splaktar avatar Mar 25 '18 03:03 Splaktar