diff options
author | Anna Koskinen <Ansku@users.noreply.github.com> | 2019-07-12 09:05:20 +0300 |
---|---|---|
committer | Zhe Sun <31067185+ZheSun88@users.noreply.github.com> | 2019-07-12 09:05:20 +0300 |
commit | 41de4e402e4b718804c71e9629c2030ff17df3e4 (patch) | |
tree | f824a211c7d5a0385d33957626e9f2ec42a7b43c /client | |
parent | 209a1cc77f619cad3e82afbd3ebd1ffbff560ef0 (diff) | |
download | vaadin-framework-41de4e402e4b718804c71e9629c2030ff17df3e4.tar.gz vaadin-framework-41de4e402e4b718804c71e9629c2030ff17df3e4.zip |
Ensure the selection has been changed before updating . (#11658)
- Initial fix attempt interfered with selection events, added regression
testing for those and found a better way to ensure shift selection works
on IE11 also with Windows 7.
Fixes #11608
Diffstat (limited to 'client')
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/VListSelect.java | 18 |
1 files changed, 7 insertions, 11 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 2a3b98996e..f8b6bae23b 100644 --- a/client/src/main/java/com/vaadin/client/ui/VListSelect.java +++ b/client/src/main/java/com/vaadin/client/ui/VListSelect.java @@ -26,7 +26,6 @@ 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; @@ -121,11 +120,6 @@ public class VListSelect extends Composite final JsonObject item = items.get(i); // reuse existing option if possible 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); @@ -133,7 +127,13 @@ public class VListSelect extends Composite select.addItem(MultiSelectWidget.getCaption(item), key); } final boolean selected = MultiSelectWidget.isSelected(item); - select.setItemSelected(i, selected); + + // Check that the selection has changed before updating it because + // IE11 causes problems on Windows 7 if we update without needing to + if (selected != select.isItemSelected(i)) { + select.setItemSelected(i, selected); + } + if (selected) { selectedItemKeys.add(key); } @@ -155,10 +155,6 @@ public class VListSelect extends Composite for (int i = 0; i < select.getItemCount(); i++) { if (select.isItemSelected(i)) { String key = select.getValue(i); - if (BrowserInfo.get().isIE11() && key != null) { - // remove the IE11 workaround - key = key.trim(); - } selectedItemKeys.add(key); } } |