diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-02-04 23:17:10 +0100 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-02-04 23:17:10 +0100 |
commit | 15e4dcdedd91421e10b80a83b63899439956911a (patch) | |
tree | a5c858f3665b9d9a9a316492229b2ba1c9c0bda4 | |
parent | 3ef4f63ec257cf90ad4bf8695a1e4e291f811af2 (diff) | |
download | UXP-15e4dcdedd91421e10b80a83b63899439956911a.tar UXP-15e4dcdedd91421e10b80a83b63899439956911a.tar.gz UXP-15e4dcdedd91421e10b80a83b63899439956911a.tar.lz UXP-15e4dcdedd91421e10b80a83b63899439956911a.tar.xz UXP-15e4dcdedd91421e10b80a83b63899439956911a.zip |
Editable menulist loosing editable attribute gets focus stuck
Bug(s):
https://bugzilla.mozilla.org/show_bug.cgi?id=1142224
(native in moebius)
-rw-r--r-- | toolkit/content/widgets/menulist.xml | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/toolkit/content/widgets/menulist.xml b/toolkit/content/widgets/menulist.xml index ccdf3bd26..96c011809 100644 --- a/toolkit/content/widgets/menulist.xml +++ b/toolkit/content/widgets/menulist.xml @@ -129,8 +129,22 @@ <property name="label" readonly="true" onget="return this.getAttribute('label');"/> <property name="description" onset="this.setAttribute('description',val); return val;" onget="return this.getAttribute('description');"/> - <property name="editable" onset="this.setAttribute('editable',val); return val;" - onget="return this.getAttribute('editable') == 'true';"/> + + <property name="editable" onget="return this.getAttribute('editable') == 'true';"> + <setter> + <![CDATA[ + if (!val && this.editable) { + // If we were focused and transition from editable to not editable, + // focus the parent menulist so that the focus does not get stuck. + if (this.inputField == document.activeElement) + window.setTimeout(() => this.focus(), 0); + } + + this.setAttribute("editable", val); + return val; + ]]> + </setter> + </property> <property name="open" onset="this.menuBoxObject.openMenu(val); return val;" |