From: Roan Kattouw Date: Mon, 31 Jul 2017 19:22:59 +0000 (-0700) Subject: Follow-up b446a3b9: don't auto-close DateInputWidget too early X-Git-Tag: 1.31.0-rc.0~2527^2 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=d13f76bc3045475a6a35563b635236d473056a65;p=lhc%2Fweb%2Fwiklou.git Follow-up b446a3b9: don't auto-close DateInputWidget too early Clicking on a month does not mean that the user has made a selection, it only means that if we are in { precision: 'month' } mode. In { precision: 'day' } mode, clicking a month is navigational, so don't auto-close in that case. Bug: T172041 Change-Id: I16a3e15a3b69844ff866fc09ba6a9268e85b2930 --- diff --git a/resources/src/mediawiki.widgets/mw.widgets.DateInputWidget.js b/resources/src/mediawiki.widgets/mw.widgets.DateInputWidget.js index ce9cf36bb3..f10c93db48 100644 --- a/resources/src/mediawiki.widgets/mw.widgets.DateInputWidget.js +++ b/resources/src/mediawiki.widgets/mw.widgets.DateInputWidget.js @@ -575,13 +575,13 @@ * @return {boolean} False to cancel the default event */ mw.widgets.DateInputWidget.prototype.onCalendarClick = function ( e ) { + var targetClass = this.calendar.getPrecision() === 'month' ? + 'mw-widget-calendarWidget-month' : + 'mw-widget-calendarWidget-day'; if ( !this.isDisabled() && e.which === 1 && - ( - $( e.target ).hasClass( 'mw-widget-calendarWidget-day' ) || - $( e.target ).hasClass( 'mw-widget-calendarWidget-month' ) - ) + $( e.target ).hasClass( targetClass ) ) { this.deactivate( true ); return false;