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, capture: true,
mozSystemGroup: 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 is to close the picker when input element blurs.
this.mInputElement.addEventListener("blur", this, this.mInputElement.addEventListener("blur", this,
{ mozSystemGroup: true }); { mozSystemGroup: true });
@ -1080,22 +1084,26 @@
<destructor> <destructor>
<![CDATA[ <![CDATA[
this.mInputElement = null;
this.EVENTS.forEach((eventName) => { this.EVENTS.forEach((eventName) => {
this.removeEventListener(eventName, this, { mozSystemGroup: true }); this.removeEventListener(eventName, this, { mozSystemGroup: true });
}); });
this.removeEventListener("keypress", onKeyPress, { this.removeEventListener("keypress", this, {
capture: true, capture: true,
mozSystemGroup: true mozSystemGroup: true
}); });
this.mInputElement.removeEventListener("click", this,
{ mozSystemGroup: true });
this.mInputElement.removeEventListener("blur", this,
{ mozSystemGroup: true });
this.mInputElement = null;
]]> ]]>
</destructor> </destructor>
<property name="EVENTS" readonly="true"> <property name="EVENTS" readonly="true">
<getter> <getter>
<![CDATA[ <![CDATA[
return ["click", "focus", "blur", "copy", "cut", "paste", "mousedown"]; return ["focus", "blur", "copy", "cut", "paste", "mousedown"];
]]> ]]>
</getter> </getter>
</property> </property>
@ -1413,12 +1421,9 @@
<parameter name="aEvent"/> <parameter name="aEvent"/>
<body> <body>
<![CDATA[ <![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()) { if (aEvent.defaultPrevented || this.isDisabled() || this.isReadonly()) {
return; return;
} }