combobox autocomplete wrong behaviour

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major
    • None
    • Affects Version/s: 9.0.1, 9.6.2
    • Component/s: Components
    • Security Level: Jimmy
    • Environment:
      • OpenJDK 1.8.0_345
      • Tomcat 9.0.62
      • ZK 9.0.1 and later
    • None

      Steps to Reproduce

      Given following view model and zul

      import java.util.Arrays;
      
      import org.zkoss.bind.annotation.Init;
      import org.zkoss.zul.ListModel;
      import org.zkoss.zul.SimpleListModel;
      
      public class TestViewModel {
      	private ListModel<String> model;
      
      	public ListModel<String> getModel() {
      		return model;
      	}
      
      	@Init
      	public void init() {
      		model = new SimpleListModel<String>(Arrays.asList("a1", "a2", "a3", "a4", "a5", "b1", "b2"));
      	}
      }
      
      <vlayout viewModel="@id('vm') @init('TestViewModel')">
      	<combobox autocomplete="true" width="18px" model="@load(vm.model)" autodrop="true" />
      </vlayout>
      
      1. type "a"
      2. click item "a5"
      3. type "a"
      4. click item "a4"

      Current Result

      First item, "a1", is selected

      Expected Result

      Item "a4" is selected. Versions up to and including 9.0.0.1 work as expected.

      Debug info

      1st
      1. doKeyUp > _typeahead
      valueEnter=a, inp.value=a (no comboitems rendered)
      2. setRepos > _typeahead
      valueEnter=a, inp.value=a1

      2nd

      1. doKeyUp > _typeahead
      valueEnter=a, inp.value=a1 (comboitem rendered)
      2. setRepos > _typeahead
      valueEnter=a1, inp.value=a1
      3. onblur
      onChanging fired

      • the 2nd time input, combobox fills 'a1' very fast because comboitem are rendered already.
      • when clicking an item, onBlur fires onChanging, then cause removing comboitems immediately, cause not able to click a comboitem.
      • only can reproduce this error when the network latency is quite short < 50ms

      Workaround

      zk-5248-3.js

        1. 15482.zul
          0.5 kB
          hawk
        2. zk-5248.zul
          0.2 kB
          hawk
        3. zk-5248-3.js
          1 kB
          hawk
        4. ZK5248VM.java
          0.3 kB
          hawk

            Assignee:
            Unassigned
            Reporter:
            benedetti
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: