зеркало из https://github.com/mozilla/pjs.git
Bug 346318 Datepicker appears only briefly when clicking on date dropdown in event dialog r=dmose
This commit is contained in:
Родитель
1f7ae111e5
Коммит
10a10725b9
|
@ -95,7 +95,9 @@
|
|||
onkeypress="if (event.keyCode == 13) this.kDatePicker.parseTextBoxDate(true);"
|
||||
xbl:inherits="disabled">
|
||||
<xul:menupopup popupanchor="bottomright" popupalign="topright"
|
||||
onpopupshowing="this.parentNode.kDatePicker.onPopup()">
|
||||
anonid="datepopup"
|
||||
onpopupshowing="onPopup()"
|
||||
onpopuphiding="reshowPopup()">
|
||||
<xul:minimonth/>
|
||||
</xul:menupopup>
|
||||
</xul:menulist>
|
||||
|
@ -120,12 +122,12 @@
|
|||
this.value = new Date();
|
||||
}
|
||||
this.kMinimonth.addEventListener("select", this.clickDate, false);
|
||||
this.kMinimonth.addEventListener("monthchange", this.reshowPopup, false);
|
||||
this.kMinimonth.addEventListener("popuplisthidden", this.reshowPopup, false);
|
||||
this.mIsReshowing = false;
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<!-- We only let the popup close if this is true.-->
|
||||
<field name="mReallyClose">false</field>
|
||||
|
||||
<method name="update">
|
||||
<parameter name="aValue"/>
|
||||
<parameter name="aRefresh"/>
|
||||
|
@ -167,7 +169,11 @@
|
|||
this.mInPopup = false;
|
||||
// select all to remove cursor since can't type while popped-up
|
||||
this.select();
|
||||
// From this point on, until the user does something we
|
||||
// care about, we shouldn't close.
|
||||
this.mReallyClose = false;
|
||||
}
|
||||
this.mIsReshowing = false;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
@ -178,14 +184,18 @@
|
|||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var datepicker = aEvent.target.parentNode.parentNode.kDatePicker;
|
||||
datepicker.mIsReshowing = true;
|
||||
try {
|
||||
aEvent.target.parentNode.hidePopup();
|
||||
aEvent.target.parentNode.showPopup();
|
||||
} finally {
|
||||
datepicker.mIsReshowing = false;
|
||||
if (this.mReallyClose) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.mIsReshowing = true;
|
||||
var popup = document.getAnonymousElementByAttribute(this, "anonid", "datepopup");
|
||||
// This must be in a timeout in order to give the popup time to
|
||||
// finish closing. Otherwise, our widget will think the popup is
|
||||
// still open, and hence it will ignore this call, and then close
|
||||
// a split-second later. See bug 348146
|
||||
setTimeout(popup.showPopup, 0);
|
||||
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
@ -220,6 +230,7 @@
|
|||
datepicker.update(new Date(aEvent.target.value), true);
|
||||
// select changed value so no cursor appears (can't type to it).
|
||||
datepicker.select();
|
||||
this.mReallyClose = true;
|
||||
aEvent.target.parentNode.hidePopup();
|
||||
}
|
||||
]]>
|
||||
|
|
Загрузка…
Ссылка в новой задаче