Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4721

Timebox with tablet-ui disabled discard virtual keyboard value on mobile

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 9.5.1
    • 6.5.8.1, 9.5.0.1
    • Browser Issue, Components
    • Security Level: Jimmy
    • reproducing on chrome mobile 

      CHROME 86.0.4240.185

      on android

      Android 10; SM-A505GN Build QP1A.190711.020

      doesn't reproduce on desktop chrome with emulation mode, Firefox on Android, and iPad mini chrome

    • ZK 9.5.1 S1

      Steps to Reproduce

      Must run on mobile with tablet-ui disabled

      Run code on mobile phone:

      <zk xmlns:w="client">
      <!--    <script><![CDATA[  
          zk.afterLoad("zul.db", function () {
              var _xTimebox = {};
              zk.override(zul.db.Timebox.prototype, _xTimebox, {
                  doBlur_: function (evt) {
                  // skip onchange, Bug 2936568
                  if (!this._value && !this._changed && zul.db.Timebox._unformater && ! zk.mobile)
                      this.getInputNode().value = this._defRawVal = '';
                      this.$supers('doBlur_', arguments);
                      zul.inp.RoundUtl.doBlur_(this);
                  }
               });
          });
      ]]></script>-->  <zscript>
          org.zkoss.lang.Library.setProperty("org.zkoss.zkmax.tablet.ui.disabled", "true");
        </zscript>
          <timebox buttonVisible="false" onChange="System.out.println(event.getValue().toString())"></timebox>
      </zk>
      
      

      Tap on timebox and edit the value

      Tap out of the timebox to trigger blur

      Current Result

       onChange event is not sent, input value is reset to ""

      Expected Result

      onChange is sent, input value is not reset to ""

      Debug Information

      https://github.com/zkoss/zk/blob/fe89147e0fd9826a007424e5bc719177deb56f2b/zul/src/archive/web/js/zul/db/Timebox.js#L506

      if (!this._value && !this._changed && !Timebox._unformater)
          this.getInputNode().value = this._defRawVal = '';

      This is triggered during blur, reseting the value, preventing use of the timebox

      Workaround

       disabled the check for zk.mobile

      <zk xmlns:w="client">
      <!--    <script><![CDATA[  
          zk.afterLoad("zul.db", function () {
              var _xTimebox = {};
              zk.override(zul.db.Timebox.prototype, _xTimebox, {
              doBlur_: function (evt) {
              // skip onchange, Bug 2936568
              if (!this._value && !this._changed && zul.db.Timebox._unformater && ! zk.mobile)
                  this.getInputNode().value = this._defRawVal = '';        this.$supers('doBlur_', arguments);        zul.inp.RoundUtl.doBlur_(this);
          }
               });
          });
      ]]></script>-->  
      

            rudyhuang rudyhuang
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 4 hours Original Estimate - 4 hours
                4h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours
                6h