diff options
author | Anna Koskinen <Ansku@users.noreply.github.com> | 2019-06-20 15:27:54 +0300 |
---|---|---|
committer | Zhe Sun <31067185+ZheSun88@users.noreply.github.com> | 2019-06-20 15:27:54 +0300 |
commit | 0db7fd52e14ea4de1b3d5b9fdab356b3ba016f15 (patch) | |
tree | 2bba996860a2df8de1d1eb96f1b2302f697bd5a5 /client | |
parent | 35c27717e954a1bcaafb64e103ed651ba4a82581 (diff) | |
download | vaadin-framework-0db7fd52e14ea4de1b3d5b9fdab356b3ba016f15.tar.gz vaadin-framework-0db7fd52e14ea4de1b3d5b9fdab356b3ba016f15.zip |
Add IE11 workaround for ListSelect multiselection. (#11631)
Fixes #11608
Diffstat (limited to 'client')
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/VListSelect.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VListSelect.java b/client/src/main/java/com/vaadin/client/ui/VListSelect.java index f1a0b868ba..2a3b98996e 100644 --- a/client/src/main/java/com/vaadin/client/ui/VListSelect.java +++ b/client/src/main/java/com/vaadin/client/ui/VListSelect.java @@ -26,6 +26,7 @@ import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HasEnabled; import com.google.gwt.user.client.ui.ListBox; +import com.vaadin.client.BrowserInfo; import com.vaadin.client.FastStringSet; import com.vaadin.client.Focusable; import com.vaadin.client.connectors.AbstractMultiSelectConnector.MultiSelectWidget; @@ -119,7 +120,12 @@ public class VListSelect extends Composite for (int i = 0; i < items.size(); i++) { final JsonObject item = items.get(i); // reuse existing option if possible - final String key = MultiSelectWidget.getKey(item); + String key = MultiSelectWidget.getKey(item); + if (BrowserInfo.get().isIE11() && key != null) { + // IE11 doesn't handle numerical keys well on Win7, + // prevent incorrect type handling with extra character + key += " "; + } if (i < select.getItemCount()) { select.setItemText(i, MultiSelectWidget.getCaption(item)); select.setValue(i, key); @@ -148,7 +154,12 @@ public class VListSelect extends Composite final FastStringSet selectedItemKeys = FastStringSet.create(); for (int i = 0; i < select.getItemCount(); i++) { if (select.isItemSelected(i)) { - selectedItemKeys.add(select.getValue(i)); + String key = select.getValue(i); + if (BrowserInfo.get().isIE11() && key != null) { + // remove the IE11 workaround + key = key.trim(); + } + selectedItemKeys.add(key); } } return selectedItemKeys; |