Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(datepicker): simplify the handleBodyClick handler
Browse files Browse the repository at this point in the history
The `handleBodyClick` handler was checking whether the click occurred either in a `md-calendar-month` or a `md-calendar-year` element. It's simpler to check if it was in a `md-calendar`.

Fixes #8452.

Closes #8804
  • Loading branch information
crisbeto authored and ThomasBurleson committed Jun 20, 2016
1 parent 37905c0 commit bb04bfa
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/components/datepicker/js/datepickerDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// TODO(jelbourn): something better for mobile (calendar panel takes up entire screen?)
// TODO(jelbourn): input behavior (masking? auto-complete?)
// TODO(jelbourn): UTC mode
// TODO(jelbourn): RTL


angular.module('material.components.datepicker')
Expand Down Expand Up @@ -717,9 +716,7 @@
*/
DatePickerCtrl.prototype.handleBodyClick = function(event) {
if (this.isCalendarOpen) {
// TODO(jelbourn): way want to also include the md-datepicker itself in this check.
var closest = this.$mdUtil.getClosest;
var isInCalendar = closest(event.target, 'md-calendar-year') || closest(event.target, 'md-calendar-month');
var isInCalendar = this.$mdUtil.getClosest(event.target, 'md-calendar');

if (!isInCalendar) {
this.closeCalendarPane();
Expand Down

0 comments on commit bb04bfa

Please sign in to comment.