Skip to content

Commit

Permalink
Combobox: avoid using LinearLayout wrapper to fix broken layout of dr…
Browse files Browse the repository at this point in the history
…opdown in IE, and prevent-default backspace key events on readonly inputs to avoid unwanted browser navigation to previous page. Refs #382
  • Loading branch information
Adrian Vasiliu committed Nov 25, 2014
1 parent 8291a70 commit a106880
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions Combobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit a106880

Please sign in to comment.