dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "DateTimeInputWidget: Only show calendar when focusing date components, not...
[lhc/web/wiklou.git]
/
resources
/
src
/
mediawiki.widgets.datetime
/
DateTimeInputWidget.js
diff --git
a/resources/src/mediawiki.widgets.datetime/DateTimeInputWidget.js
b/resources/src/mediawiki.widgets.datetime/DateTimeInputWidget.js
index
e9bedf5
..
3e4c5e2
100644
(file)
--- a/
resources/src/mediawiki.widgets.datetime/DateTimeInputWidget.js
+++ b/
resources/src/mediawiki.widgets.datetime/DateTimeInputWidget.js
@@
-390,6
+390,10
@@
$field = $( '<span>' )
.width( sz )
.data( 'mw-widgets-datetime-dateTimeInputWidget-placeholder', placeholder );
$field = $( '<span>' )
.width( sz )
.data( 'mw-widgets-datetime-dateTimeInputWidget-placeholder', placeholder );
+ if ( spec.type !== 'static' ) {
+ $field.prop( 'tabIndex', -1 );
+ $field.on( 'focus', this.onFieldFocus.bind( this, $field ) );
+ }
if ( spec.type === 'static' ) {
$field.text( spec.value );
} else {
if ( spec.type === 'static' ) {
$field.text( spec.value );
} else {
@@
-628,6
+632,8
@@
* @param {jQuery.Event} e Focus event
*/
mw.widgets.datetime.DateTimeInputWidget.prototype.onFieldFocus = function ( $field ) {
* @param {jQuery.Event} e Focus event
*/
mw.widgets.datetime.DateTimeInputWidget.prototype.onFieldFocus = function ( $field ) {
+ var spec = $field.data( 'mw-widgets-datetime-dateTimeInputWidget-fieldSpec' );
+
if ( !this.isDisabled() ) {
if ( this.getValueAsDate() === null ) {
this.setValue( this.formatter.getDefaultDate() );
if ( !this.isDisabled() ) {
if ( this.getValueAsDate() === null ) {
this.setValue( this.formatter.getDefaultDate() );
@@
-637,7
+643,7
@@
}
if ( this.calendar ) {
}
if ( this.calendar ) {
- this.calendar.toggle(
true
);
+ this.calendar.toggle(
!!spec.calendarComponent
);
}
}
};
}
}
};