From a106880752782d181efb85206696b2e95e2a90b9 Mon Sep 17 00:00:00 2001 From: Adrian Vasiliu Date: Tue, 25 Nov 2014 19:26:39 +0100 Subject: [PATCH] Combobox: avoid using LinearLayout wrapper to fix broken layout of dropdown in IE, and prevent-default backspace key events on readonly inputs to avoid unwanted browser navigation to previous page. Refs #382 --- Combobox.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Combobox.js b/Combobox.js index cdc3b81559..f71f8f1af2 100755 --- a/Combobox.js +++ b/Combobox.js @@ -341,13 +341,11 @@ define([ }, _createNormalDropDown: function (list) { - // TODO: does it help to embed List in LinearLayout? - // Depends on outcome of https://github.com/ibm-js/deliteful/pull/341 - // TODO: move to separate widget. - var topLayout = new LinearLayout(); - domClass.add(list, "fill"); - topLayout.addChild(list); - return topLayout; + // Use the List itself as content of the popup. Embedding it in a + // LinearLayout has seemed useful for solving layout issues on iOS + // (deliteful issue #270), but appears to be harmful on IE11 (deliteful + // issue #382). Hence the List is not wrapped anymore inside a LinearLayout. + return list; }, _createCenteredDropDown: function (list) { @@ -430,6 +428,14 @@ define([ evt.stopPropagation(); evt.preventDefault(); }.bind(this), inputElement); + this.on("keydown", function (evt) { + // deliteful issue #382: prevent the browser from navigating to + // the previous page when typing backspace in a readonly input + if (inputElement.readOnly && evt.keyCode === keys.BACKSPACE) { + evt.stopPropagation(); + evt.preventDefault(); + } + }.bind(this), inputElement); }, _validateMultiple: function (inputElement) {