Bug 1371111 - Open picker when input element's padding area is clicked

+ Bug 1341029: https://bugzilla.mozilla.org/show_bug.cgi?id=1341029
(partially - partially - fix typo in removeEventListener):

https://hg.mozilla.org/mozilla-central/diff/6055065a2ed5/toolkit/content/widgets/datetimebox.xml
+ Bug 1410292: https://bugzilla.mozilla.org/show_bug.cgi?id=1410292
This commit is contained in:
janekptacijarabaci 2018-03-30 23:54:41 +02:00 committed by Roy Tam
commit 758ef612dc

View file

@ -1072,6 +1072,10 @@
capture: true,
mozSystemGroup: true
});
// This is to open the picker when input element is clicked (this
// includes padding area).
this.mInputElement.addEventListener("click", this,
{ mozSystemGroup: true });
// This is to close the picker when input element blurs.
this.mInputElement.addEventListener("blur", this,
{ mozSystemGroup: true });
@ -1080,22 +1084,26 @@
<destructor>
<![CDATA[
this.mInputElement = null;
this.EVENTS.forEach((eventName) => {
this.removeEventListener(eventName, this, { mozSystemGroup: true });
});
this.removeEventListener("keypress", onKeyPress, {
this.removeEventListener("keypress", this, {
capture: true,
mozSystemGroup: true
});
this.mInputElement.removeEventListener("click", this,
{ mozSystemGroup: true });
this.mInputElement.removeEventListener("blur", this,
{ mozSystemGroup: true });
this.mInputElement = null;
]]>
</destructor>
<property name="EVENTS" readonly="true">
<getter>
<![CDATA[
return ["click", "focus", "blur", "copy", "cut", "paste", "mousedown"];
return ["focus", "blur", "copy", "cut", "paste", "mousedown"];
]]>
</getter>
</property>
@ -1413,12 +1421,9 @@
<parameter name="aEvent"/>
<body>
<![CDATA[
this.log("onClick originalTarget: " + aEvent.originalTarget);
this.log("onClick originalTarget: " + aEvent.originalTarget +
" target: " + aEvent.target);
// XXX: .originalTarget is not expected.
// When clicking on one of the inner text boxes, the .originalTarget is
// a HTMLDivElement and when clicking on the reset button, it's a
// HTMLButtonElement.
if (aEvent.defaultPrevented || this.isDisabled() || this.isReadonly()) {
return;
}